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!
I have written a somewhat lengthy measure which uses one of two values available in a slicer to produce values for a line graph.
I do however not want to perform this particular calculation on years other than the current. What I want is to have a different calculation take place if the year is not the current. This is where I've gotten a bit stuck.
The main calculation:
Is it possible to simultaneously have this calculation take place ONLY for current year, and use another calulation for previous years?
Solved! Go to Solution.
Hi @KrisD
Yes, it is possible. Assume you have two measures, MeasureA for current year and MeasureB for previous years. You can create a measure like below and use it in the line chart. You can use different calculation in MeasueA and MeasureB according to your needs.
MeasureSample =
VAR currentYear = YEAR ( TODAY () )
RETURN
IF ( SELECTEDVALUE ( 'Table'[Year] ) = currentYear, [MeasureA], [MeasureB] )
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
Hi @KrisD
Yes, it is possible. Assume you have two measures, MeasureA for current year and MeasureB for previous years. You can create a measure like below and use it in the line chart. You can use different calculation in MeasueA and MeasureB according to your needs.
MeasureSample =
VAR currentYear = YEAR ( TODAY () )
RETURN
IF ( SELECTEDVALUE ( 'Table'[Year] ) = currentYear, [MeasureA], [MeasureB] )
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
Great! I used CurrentYear to check what year it was in the visual, but failed to use SelectedValue which was the missing component to achieve my goal. Your input is much appreciated!
The final result (if anyone in the future should ask a similar question in this forum):
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |