Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.
Hello,
I need to calculate the number of distinct teams where the earliest date is greater than the latest date score, and I want to apply date filtering using a slicer. please help me out.
Thanks
Solved! Go to Solution.
Hi @MithSingh ,
Thanks for explaining the issue again.
I tried the following measure. This should work.
Test =
var min_date = MIN(Score[Date])
var max_date = MAX(Score[Date])
var table1 = SUMMARIZE(Score,Score[Team])
var table2 = ADDCOLUMNS(table1,"MinScore",CALCULATE(SUM(Score[Score]),Score[Date]=min_date),"MaxScore",CALCULATE(SUM(Score[Score]),Score[Date]=max_date))
var table3 = ADDCOLUMNS(table2,"Flag",IF([MinScore]>[MaxScore],1,0))
return
COUNTX(FILTER(table3,[Flag]=1),DISTINCTCOUNT([Team]))
If this works, please mark this reply as the solution.
Thank you!
so if we select dates through silicer from 1/1/2023 to 1/2/2023, then
These Teams will meet the criteria:
Team B because it's earliest date has a score 5 and the latest date score has 2, so the earliest date is greater than the latest date score
Team D because it's earliest date has a score 6 and the latest date score has 2, so the earliest date is greater than the latest date score
so measure should return the result = 2, total unique team count
Hi @MithSingh ,
Thanks for explaining the issue again.
I tried the following measure. This should work.
Test =
var min_date = MIN(Score[Date])
var max_date = MAX(Score[Date])
var table1 = SUMMARIZE(Score,Score[Team])
var table2 = ADDCOLUMNS(table1,"MinScore",CALCULATE(SUM(Score[Score]),Score[Date]=min_date),"MaxScore",CALCULATE(SUM(Score[Score]),Score[Date]=max_date))
var table3 = ADDCOLUMNS(table2,"Flag",IF([MinScore]>[MaxScore],1,0))
return
COUNTX(FILTER(table3,[Flag]=1),DISTINCTCOUNT([Team]))
If this works, please mark this reply as the solution.
Thank you!
Yes, It's working. Thank you Sir:) It's a great help.😊😊
Hi @MithSingh ,
Can you please explain in little detail. Out of the rows that you have shared which row will meet the criteria you have mentioned.
What I could understand is you want the Count of Teams where the Earliest date's score is greater than the Latest Date's score.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
74 | |
70 | |
70 | |
45 | |
41 |
User | Count |
---|---|
48 | |
47 | |
29 | |
28 | |
28 |