Forum Discussion
Create Calculated Fields based on Field Parameter selected
- Anonymous3 years ago
Hi Anonymous ,
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.