Forum Discussion
automatically modify a measure with a segment/filter on the name of the column
hello,
i think that is a very commun question, but i don't know how to find it...
i have a lot of column which correspond of different parameters.
For one column (so for one parameter) i did few new measures (as the summation and the difference of the average and the standart deviation of my parameter merge by day). But now i want to apply these new measures for each column automatically (not by hand). So i want my column name to be a variable... by this way, with the segment/filter on the column name the measure and the curve will change too.
I put a schema (i hope it is clear... i don't know how to explain easily) :
Thanks a lot
Hi Anonymous ,
In Power Query, select your [Date] column in your parameter table, go to Transform tab > Unpivot Columns (dropdown) > Unpivot Other Columns. This will put all of your column names into an [Attribute] column, and each of your parameter values into a [Value] column. You can change the names of these columns to suit your use by overtyping them in the M code seen in the formula bar on the unpivot step.
This is the correct/optimum data structure for use with Power BI.
In your report, write your measure referring to the [Value] column, and use the [Attribute] column in your slicer.
Pete
2 Replies
- BA_Pete
Super User
Hi Anonymous ,
In Power Query, select your [Date] column in your parameter table, go to Transform tab > Unpivot Columns (dropdown) > Unpivot Other Columns. This will put all of your column names into an [Attribute] column, and each of your parameter values into a [Value] column. You can change the names of these columns to suit your use by overtyping them in the M code seen in the formula bar on the unpivot step.
This is the correct/optimum data structure for use with Power BI.
In your report, write your measure referring to the [Value] column, and use the [Attribute] column in your slicer.
Pete
- AnonymousNot applicable
of course !!! rolala my bad... unpivot is really cool when we use an old and badly thought table.
thanks, i accept your solution =D