Forum Discussion
Year over year % change without date column
- Anonymous1 year ago
Hi Anonymous ,
Please modify the measure syntax as shown below:
event_distinctcount_PY = VAR _currentYear = VALUE ( MID ( SELECTEDVALUE ( 'Table'[year_month] ), 2, 2 ) ) VAR _currentMonth = VALUE ( MID ( SELECTEDVALUE ( 'Table'[year_month] ), 5, 2 ) ) var _Slicer_Country = VALUES('Table'[country]) RETURN CALCULATE ( DISTINCTCOUNT ( 'Table'[event] ), FILTER ( ALL ( 'Table' ), VALUE ( MID ( 'Table'[year_month], 2, 2 ) ) = _currentYear - 1 && VALUE ( MID ( 'Table'[year_month], 5, 2 ) ) = _currentMonth &&'Table'[country] IN _Slicer_Country ) )If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi Yang,
Thank you so much for your response! When I select just Y24 value(s) in the year_month slicer, the results table shows blank for the PY measure. How do we make the PY measure work without having to also select the PY values in the year_month slicer?
Thank you!
Hi Anonymous ,
Please modify this measure as shown below, all else being equal:
event_distinctcount_PY =
VAR _currentYear =
VALUE ( MID ( SELECTEDVALUE ( 'Table'[year_month] ), 2, 2 ) )
VAR _currentMonth =
VALUE ( MID ( SELECTEDVALUE ( 'Table'[year_month] ), 5, 2 ) )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Table'[event] ),
FILTER (
ALL ( 'Table' ),
VALUE ( MID ( 'Table'[year_month], 2, 2 ) ) = _currentYear - 1
&& VALUE ( MID ( 'Table'[year_month], 5, 2 ) ) = _currentMonth
)
)
The final visual effect is shown below:
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
- Anonymous1 year agoNot applicable
Hi Anonymous ,
When I modified from ALLSELECTED to ALL then the Country slicer stops applying to the PY measure. Is there a way we can modify it so that this measure will be filtered by all other slicers but not the year_month slicer?
Thank you!
- Anonymous1 year agoNot applicable
Hi Anonymous ,
Please modify the measure syntax as shown below:
event_distinctcount_PY = VAR _currentYear = VALUE ( MID ( SELECTEDVALUE ( 'Table'[year_month] ), 2, 2 ) ) VAR _currentMonth = VALUE ( MID ( SELECTEDVALUE ( 'Table'[year_month] ), 5, 2 ) ) var _Slicer_Country = VALUES('Table'[country]) RETURN CALCULATE ( DISTINCTCOUNT ( 'Table'[event] ), FILTER ( ALL ( 'Table' ), VALUE ( MID ( 'Table'[year_month], 2, 2 ) ) = _currentYear - 1 && VALUE ( MID ( 'Table'[year_month], 5, 2 ) ) = _currentMonth &&'Table'[country] IN _Slicer_Country ) )If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!