Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 @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
User | Count |
---|---|
106 | |
89 | |
81 | |
76 | |
73 |
User | Count |
---|---|
112 | |
104 | |
96 | |
74 | |
66 |