set Power Query display folder for a query column in M? - powerbi

I have a number of very wide datasets in Power Query - hundreds of columns each (don't ask). I am trying to determine if (how) to assign columns to display folders programatically. I have access to some data that I could use to assign the display folder based on the column name. Some research into the metadata functions in M is tantalizing but I have not found the silver bullet example yet. Has anyone attempted this?
I've done some basic research and written some bits of M to look at the metadata functions, but that's about it. I was hoping someone might have the magic function call needed to set the display folder, or know if it is even possible.

Related

SUMIF type column in PowerBI

I want to count the number of stores in a particular region within Power BI. Similar to how you would use a SUMIF in Excel.
Below is a rough example of what I mean (and the data in its current format) as I am unable to share actual snips due to sensitive information.
I'm happy for any working solution, even if the count of stores is repeated on the store lines.
Thanks.

Is there a way that POWERBI does not agregate all numeric data?

so, I got 3 xlsx full of data already treated, so I pretty much just got to display the data using the graphs. The problem seems to be, that Powerbi aggregates all numeric data (using: count, sum, etc.) In their community they suggest to create new measures, the thing is, in that case I HAVE TO CREATE A LOT OF MEASURES...Also, I tried to convert the data to text and even so, Powerbi counts it!!!
any help, pls?
There are several ways to tackle this:
When you pull a field into the field well for a visualisation, you can click the drop down in the field well and select "Don't summarize"
in the data model, select the column and on the ribbon select "don't summarize" as the summarization option in the Properties group.
The screenshot shows the field well option on the left and the data model options on the right, one for a numeric and one for a text field.
And, yes, you never want to use the implicit measures, i.e. the automatic calculations that Power BI creates. If you want to keep on top of what is being calculated, create your own measures, and yes, there will be many.
Edit: If by "aggregating" you are referring to the fact that text values will be grouped in a table (you don't see any duplicates), then you need to add a column with unique values to the table so all the duplicates of the text values show up. This can be done in the data source by adding an Index column, then using that Index column in the table and setting it to a very narrow with to make it invisible.

How to deal with header names changing in CSV data source?

Will make this short and sweet - we have a massive .CSV that we are linking to PBI Desktop. Some of the header names in this .CSV were not optimal and have since been updated by the SQL backend. However, PBI is not happy with not being able to find the exact header that existed previously, and we could not find a route by which to tell the software that a header name had changed. Is there a quick solution for this?
Here is an idea to work around this issue,
as long as your header are changing, I recommend you to do these step in power query:
search on your power query the step where the headers are promoted
instead of this step, delete the first row (the one containing the headers)
Then add a step renaming the header as desired
Hope that helps
Quick.. Not so much. Easy? Relatively.
You'll need to manually edit the PowerQuery in the Advanced Query side.
I recommend un-hiding the formula bar in the Query Editor and going step by step through the applied steps. Once you find a broken step, check out the PowerQuery, you'll see your no longer existent fields there as plain text in the formula bar ( or advanced editor view ). Swap out the old field names in the PowerQuery with the new names and you should be golden.
You might even get away with a few find/replaces..
You can fix this if you delete your top rows in your first row operation in query editor. This way the CODE of your power BI query will not contain a specific name and will name your columns: 'column 1' ; 'column 2' etc.etc.
You can now edit to your own demands and when you change datasource nothing will go in error.
Hope this helps for people who are also looking into the problem.

Power Query Formula Language - Detect type of columns

In Power BI, I've got some query tables generated from imported data. All the data comes in as type 'Any', and I'm trying to automatically detect the type of the data in each column.
Some of the queries generate tables with columns based on the in-coming data - I don't know what the columns are going to be until the query runs and sets up the table (data comes from an Azure blob). As I will have quite a few tables to maintain, which columns can change (possibly new columns being added) with any data refresh, it would be unmanageable to go through all of them each time and press 'Detect Data Type' on the columns.
So I'm trying to figure out how I can do a 'Detect Data Type' in the query formula language to attach to the end of the query that generates the table columns. I've tried grabbing the first entry in a column and do Value.Type(column{0}), however this seems to come out as 'Text' for a column which has integers in it. Pressing 'Detect Data Type' does however correctly identifies the type as 'Whole Number'.
Does anyone know how to detect a column's entry types?
P.S. I'm not too worried about a column possibly holding values of different data types
You seem to have multiple issues here. And your solution will be fragile, there's a better way. But let's first deal with column type detection. Power Query uses the 'any' data type as it's go to data type. You can write a function that samples the rows of a column in a table does a best match data type detection then explicitly sets the data type of the column. This is probably messy and tricky since you need to do it once per column. This might be workable for a fixed schema but for a dynamic schema you'll run into a couple of things very quickly. First you'll need to write some crazy PQ code to list all the columns and run you function on each. This will work the first time, but might break in subsequent refreshes because data model changes are not allowed during refresh. If you're using a tool like Power BI Desktop, you'll be able to fix things up. If you publish your report to the Power BI service, you'll just see refresh errors.
Dynamic Schemas will suffer the same data model change issue I mentioned above.
The alternate solution that you won't have problems with is using a Direct Query data source instead of using Power Query. If you load your data into Azure SQL or a Tabular Model, the reporting layer will get the updated fields automatically so you don't have to try to work around using PQ.

SAS Enterprise Miner split Dataset by binary variable

I am using the SAS Enterprise Miner 13.2.
I have a SAS table as a data source. In this table i have a binary variable D_TYP ( "I" and "P" ) and other categorical variables.
I want to split the data by D_TYP so i got two tables. One with all "I" and the other with "P". The problem i don’t know how.
I have been looking in the taskbar and i tried Filter and Data Partition. I can probably use SAS Code to split the Data but i think there is an other way with the taks.
You could use two filter nodes to do the job, with one filtering out I and the another filtering out P. The resulted data set should only consist of one type of the binary variable. In case you are not familiar with the filter node, click on the option Class Variable at properties panel and apply User specified filter. You have to manually select the group by clicking on its corresponding bar.