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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello Folks,
I need your urgent help on the dax where I get to see last 4 Period (months) of data in a bar chart
For example.
If I choose "Football" from the "Game" slicer then I get to see data from February 2024 to May 2024.
But If I choose "Snooker" from the Game slicer I get to see only March 2024 & May 2024 Data
"I would like to get exactly like explained below"
Whereas, when I choose "snooker" from the Game Slicer I would like to see July 2023, August 2023, March 2024 & May 2024 data becuase there is no data in the month of February 2024 and April 2024.
The DAX measure that I have used is this:
Please urgently help me on getting this right.
Here is the link to access the pbix file and dataset
Solved! Go to Solution.
Hi @BI_Data_Analyst ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create COLUMN in power query
=Date.ToText([Date],[Format = "yyyyMM"])
Create a calculated column
Rank =
RANKX(
CALCULATETABLE(
'Table',
ALLEXCEPT(
'Table',
'Table'[Game]
)
),
[Custom],,
ASC,
Dense
)
Create measures
Measure =
VAR _maxRank =
CALCULATE(
MAX('Table'[Rank]),
ALLEXCEPT('Table','Table'[Game])
)
RETURN
IF(
SELECTEDVALUE('Table'[Rank]) > _maxRank - 4,
1,
0
)Divide =
DIVIDE(
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[Response] = "Yes"
)
),
COUNTROWS('Table')
)
Use measure as filter on this visual
Fianl output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Anonymous ,
Can you please help me with the above workaround as explained by @BI_Data_Analyst
Its really urgent for me.
Thanks in advannce!
Kind regards,
Ash
Hi @BI_Data_Analyst ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create COLUMN in power query
=Date.ToText([Date],[Format = "yyyyMM"])
Create a calculated column
Rank =
RANKX(
CALCULATETABLE(
'Table',
ALLEXCEPT(
'Table',
'Table'[Game]
)
),
[Custom],,
ASC,
Dense
)
Create measures
Measure =
VAR _maxRank =
CALCULATE(
MAX('Table'[Rank]),
ALLEXCEPT('Table','Table'[Game])
)
RETURN
IF(
SELECTEDVALUE('Table'[Rank]) > _maxRank - 4,
1,
0
)Divide =
DIVIDE(
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[Response] = "Yes"
)
),
COUNTROWS('Table')
)
Use measure as filter on this visual
Fianl output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Anonymous ,
Thank you so much for your support.
(1)Just wondering if we can select "Ireland" from "Game Origin" filter and yet we are able to see Baseball Chart.
(Because Baseball game is a part of Ireland)
(2) and when nothing is selected from any of the filters we get last 4 months "Divide" of the overall data.
Kind regards,
Ash.
Hi @v-heq-msft ,
Can you please help me with the above workaround as explained by @BI_Data_Analyst
Its really urgent for me.
Thanks in advannce!
Kind regards,
Ash
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!