March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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):
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |