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.
Hello everyone!
I have a yearly execution view where I would like to switch between the YTD and MTD.
I have the following to measures:
Orders MTD
=
CALCULATE (
[Orders],
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Fiscal Year]
= MAX ( 'Calendar'[Year] )
&& 'Calendar'[Date]
<= MAX ( 'Calendar'[Date] )
&& 'Calendar'[Fiscal Month Number]
= MAX ( 'Calendar'[Fiscal Month Number] )
)
)
Orders YTD =
CALCULATE (
[Orders],
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Fiscal Year]
= MAX ( 'Calendar'[Year] )
&& 'Calendar'[Date]
<= MAX ( 'Calendar'[Date] )
)
)
How can I create a Slicer for switching between MTD and YTD?
Solved! Go to Solution.
Create a new table using enter data option and then list the measures names. Then create a slicer out of the column and use this DAX.
SelectedMeasure =
VAR MeasureName =
VALUES ( Joshua[Measure Name] )
VAR Result =
IF (
HASONEVALUE ( Joshua[Measure Name] ),
SWITCH ( TRUE (), MeasureName = "Total Sales", [Total Sales], [Total Cost] )
)
RETURN
Result
Hi @joshua1990 ,
Sorry for that in Power BI, we cannot create a slicer using Measure.
If you want to control measure through slicer, you need to create a new table that contains the Measure’s name like @AntrikshSharma said.
Maybe you can refer this solved post.
If you have any question, please kindly ask here and we will try to resolve it.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Create a new table using enter data option and then list the measures names. Then create a slicer out of the column and use this DAX.
SelectedMeasure =
VAR MeasureName =
VALUES ( Joshua[Measure Name] )
VAR Result =
IF (
HASONEVALUE ( Joshua[Measure Name] ),
SWITCH ( TRUE (), MeasureName = "Total Sales", [Total Sales], [Total Cost] )
)
RETURN
Result
Thanks for your reply!
Is there maybe another way?
With your approach, I have to edit several measures.
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 |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |