Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I have created a line chart where I am showing fives lines coming from five measures dragged to "Values" section with Axis having "Datetime" field.
Measure calculation is similar for all five with different filter context coming from a single column [Type] as shown:
Measure 1:= CALCULATE([Count],'Table1'[Type]="Type A") Measure 2:= CALCULATE([Count],'Table1'[Type]="Type B") Measure 3:= CALCULATE([Count],'Table1'[Type]="Type C") Measure 4:= CALCULATE([Count],'Table1'[Type]="Type D") Measure 5:= CALCULATE([Count],'Table1'[Type]="Type E")
Graph is showing five lines with respect to these five measure.
I also have a slicer on this column = [Type]
I want:
1) If I select any one value (Type A or Type B or Type C or Type D or Type E) from this [Type] slicer only for that type, line should come on chart and others should go away.
2) If I select any two or more than two values from slicer then only those lines should be there for which type values are selected from slicer.
I tried using SELECTEDVALUE but it doesn't give required results. As shown for new measure 1:
Measure 1 New = IF(CALCULATE(SELECTEDVALUE('Table1'[Type A])="Type A"),Measure 1,BLANK())
This works fine if I select slicer one by one but if I select any other slicer with slicer value = Type A then it fails.
Please advice.
Thanks
Solved! Go to Solution.
Thanks for checking in Ashish.
I could solve this using CONTAINS() DAX function instead of SELECTEDVALUE().
Here is the code. I have to replace these five old measure to these new ones to accomplish which I need.
Measure 1 New = VAR A = Measure 1 RETURN IF ( CONTAINS ( 'Table1', 'Table1'[Type A], "Type A" ), A, BLANK () )
Thanks for the help!
Hi,
Writing 5 measures should not be necessary. To help further, i will need to see your PBI file.
Thanks for checking in Ashish.
I could solve this using CONTAINS() DAX function instead of SELECTEDVALUE().
Here is the code. I have to replace these five old measure to these new ones to accomplish which I need.
Measure 1 New = VAR A = Measure 1 RETURN IF ( CONTAINS ( 'Table1', 'Table1'[Type A], "Type A" ), A, BLANK () )
Thanks for the help!
Hi,
Sorry but with such scanty information, i really cannot help.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |