- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Current Year and Previous year using slicer selection
Hi Team,
I have a table from which I'm showing data in Clustered Column Chart but my requirement is
If I select 2023 as a slicer value then I need to show data of 2023 and 2022 i.e., SelectedYear and SelectedYear-1.
I tried using this measure ;
Total Sales CY =
var SelectedYear = SELECTEDVALUE('Raw Data'[Year])
RETURN //IN {SelectedYear,SelectedYear-1}
CALCULATE(COUNT('Raw Data'[Centre Number]),'Raw Data'[Year] IN {SelectedYear,SelectedYear-1})
I have taken Year Slicer ( Single Select).
Since it is Clustered Column chart so I'm not allowed to use TWO MEASURES in Y-Axis.
Can anybody tell me how do I do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, @lovishsood1
You can try the following methods. Create a new unrelated year table.
MEASURE =
IF ( YEAR ( SELECTEDVALUE ( 'Table'[Date] ) ) >= SELECTEDVALUE ( Year[Year] ) - 1
&& YEAR ( SELECTEDVALUE ( 'Table'[Date] ) ) <= SELECTEDVALUE ( Year[Year] ),
1,
0
)
Is this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried with Date Column but now it's only showing data of 2022 and not 2023 ( On selecting either 2023 or 2024)
PrevYear Check =
IF ( YEAR ( SELECTEDVALUE ( 'Raw Data'[Sale Date] )) >= SELECTEDVALUE ( YearKey[Value] ) - 1
&& YEAR ( SELECTEDVALUE ( 'Raw Data'[Sale Date] ) ) <= SELECTEDVALUE ( YearKey[Value] ),
1,
0
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, @lovishsood1
Can you provide your example data or example files? And if there is sensitive information please remove it in advance.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did same as you have done except the fact I have Year column and you have used Date column in your Table!!
Still not getting results! I even disabled the relationship of MAIN Table with Date Table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Total Sales CY =
VAR SelectedYear = SELECTEDVALUE('Raw Data'[Year])
RETURN
CALCULATE(
COUNT('Raw Data'[Centre Number]),
'Raw Data'[Year] IN {SelectedYear, SelectedYear - 1}
)
Add the Year field to the Axis in the Clustered Column Chart
Add Total Sales CY to the Values field
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you attach a snapshot where I can find the Values field in the CLUSTERED COLUMN CHART?
I can only see X-Axis, Y-Axis, Legend & Small Multiples!!
P.S.: You shared my DAX Measure with me!!

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
05-03-2024 04:43 AM | |||
Anonymous
| 08-23-2024 04:47 AM | ||
06-09-2024 09:38 AM | |||
07-26-2024 06:10 PM | |||
05-30-2024 07:47 PM |
User | Count |
---|---|
84 | |
78 | |
52 | |
38 | |
35 |
User | Count |
---|---|
95 | |
72 | |
55 | |
52 | |
46 |