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 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?
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.
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
)
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.
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.
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
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!!
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 |
---|---|
124 | |
87 | |
87 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |