Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
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.
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 71 | |
| 45 | |
| 34 | |
| 28 | |
| 23 |
| User | Count |
|---|---|
| 143 | |
| 121 | |
| 59 | |
| 40 | |
| 33 |