This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I have a card visualization that shows the value based on the year selection. I have a slicer of the year (values are last 5 years- 2017, 2018, 2019, 2020, 2021). The slicer is having multiple selection options. I want to show the value of each year when a single selection of years is done, but when multiple years are selected, I want to see the value of the latest year (2021) (no sum or avg or count or first or last). Please help.
Solved! Go to Solution.
You will need a measure, something along these lines.
Display Amount =
VAR _Years =
COUNTROWS ( DISTINCT ( Table[Year] ) )
RETURN
SWITCH (
TRUE (),
_Years = 1, [Value Measure],
_Years > 1, CALCULATE ( [Value Measure], Table[Year] = 2021 )
)
Thanks a lot.. Its working now.
You need a measure to sum the value.
Value Meausure = SUM ( XYZ[Value] )
Then the measure to read the selection and display the correct version of the sum.
Display Measure =
VAR _Years =
COUNTROWS ( DISTINCT ( XYZ[Year] ) )
RETURN
SWITCH (
TRUE (),
_Years = 1, [Value Meausure],
_Years > 1, CALCULATE ( [Value Meausure], XYZ[Year] = 2021 )
)
I have attached my sample file for you to look at.
You will need a measure, something along these lines.
Display Amount =
VAR _Years =
COUNTROWS ( DISTINCT ( Table[Year] ) )
RETURN
SWITCH (
TRUE (),
_Years = 1, [Value Measure],
_Years > 1, CALCULATE ( [Value Measure], Table[Year] = 2021 )
)
I am still getting the error. This is my table (Table name XYZ).
This is my year selection slicer.
I created a new measure as below.
I am not getting the output. It would be great if you can provide detailed steps after creating the measure.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 36 | |
| 33 | |
| 27 | |
| 24 | |
| 18 |
| User | Count |
|---|---|
| 66 | |
| 50 | |
| 33 | |
| 24 | |
| 24 |