Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi Everyone
I would like to create a calculated field that is based on what I select from Field Parameters.
I created a field parameter that contains Column A (all numbers) and Column B (all numbers).
Then I tried creating a new calculated column that should be divided by the values from Column A or B, depending on the user selection. I tried it by using DAX and Power Query, but I can't seem to get it to work.
How do i go about doing this? Any help will be appreciated
Thanks
Solved! Go to Solution.
Hi @faustine ,
Please try below steps:
1. below is my test table
Table:
2. create a field parameter
3. create a measure with below dax formula
Measure =
VAR tmp =
SELECTCOLUMNS ( Parameter, "SelectColumn", [Parameter] )
VAR _str =
CONCATENATEX ( tmp, [SelectColumn] )
VAR _val =
SWITCH (
_str,
"Column1", SUMX ( SELECTCOLUMNS ( 'Table', "Column1", [Column1] ), [Column1] ),
"Column2", SUMX ( SELECTCOLUMNS ( 'Table', "Column2", [Column2] ), [Column2] )
)
VAR _val1 = 100
RETURN
DIVIDE ( _val, _val1 )
4. add a table visual and a card visual
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @faustine ,
Please try below steps:
1. below is my test table
Table:
2. create a field parameter
3. create a measure with below dax formula
Measure =
VAR tmp =
SELECTCOLUMNS ( Parameter, "SelectColumn", [Parameter] )
VAR _str =
CONCATENATEX ( tmp, [SelectColumn] )
VAR _val =
SWITCH (
_str,
"Column1", SUMX ( SELECTCOLUMNS ( 'Table', "Column1", [Column1] ), [Column1] ),
"Column2", SUMX ( SELECTCOLUMNS ( 'Table', "Column2", [Column2] ), [Column2] )
)
VAR _val1 = 100
RETURN
DIVIDE ( _val, _val1 )
4. add a table visual and a card visual
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hope the latter part of this video helps(from the 8 minute mark onwards) : https://www.youtube.com/watch?v=7mlYt6x-XCo&list=PLApPcvU5-R26t4dylOnPy8A2-lr4C0C--&index=31
I think I am almost there. The 4 columns I have are "computer name", "property number", "mac address", and "service tag". I am trying to build a unique key so if only the computer name is selected on the slicer, then it will return the computername value in the table. If they select only the property number in the slicer, it will only return the property number value in the table. If they select computer name and property number, it will bring back the computernamevalue|propertynamevalue in the table. If they select 3 slicer values, it will bring back all 3 of those values in the table. Every row has a computer name but the rows might not have any of the remainder columns. I have this measure working in a card to show the unique key format but I can't get it to work in the table where I need to bring in the values.
Uniquekey =CONCATENATEX(VALUES(ASSETSLICER[FIELD]),ASSETSLICER[FIELD], "|")
The ASSETSLICER[Field] is a calculated column that I created in the slicer table.
Field=AssetSlicer[AssetSlicer]
That measure brings back "computername" or "computername|propertynumber", etc...
Any help would be greatly appreciated.
Hope this helps:
What you're looking for is probably using a measure instead of calculated columns. Calculated columns get created at refresh time. I've never tried creating calc columns based on field parameters but no wonder if you can't
User | Count |
---|---|
96 | |
85 | |
77 | |
67 | |
63 |
User | Count |
---|---|
110 | |
96 | |
96 | |
67 | |
59 |