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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi everyone,
I am trying to calculate distinct values based on max date column.
But with measure
Solved! Go to Solution.
Hi,@lnik
I am glad to help you.
According to your description, you want to distinct count by max date?
If I understand you correctly, then you can refer to my solution.
Table 2 =
VAR _distinct =
SUMMARIZE (
'Table',
'Table'[Item],
'Table'[Customer],
'Table'[Date Visit],
"MaxDate",
CALCULATE (
MAX ( 'Table'[Date Visit] ),
FILTER ( ALL ( 'Table' ), 'Table'[Item] = EARLIER ( 'Table'[Item] ) )
)
)
RETURN
FILTER (
_distinct,
IF ( 'Table'[Item] = 3, BLANK (), 'Table'[Date Visit] = [MaxDate] )
)
DistinctCount =
VAR _currentItem =
MAX ( 'Table 2'[Item] )
RETURN
COUNTROWS ( FILTER ( ALL ( 'Table 2'[Item] ), 'Table 2'[Item] = _currentItem ) )
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,@lnik
I am glad to help you.
According to your description, you want to distinct count by max date?
If I understand you correctly, then you can refer to my solution.
Table 2 =
VAR _distinct =
SUMMARIZE (
'Table',
'Table'[Item],
'Table'[Customer],
'Table'[Date Visit],
"MaxDate",
CALCULATE (
MAX ( 'Table'[Date Visit] ),
FILTER ( ALL ( 'Table' ), 'Table'[Item] = EARLIER ( 'Table'[Item] ) )
)
)
RETURN
FILTER (
_distinct,
IF ( 'Table'[Item] = 3, BLANK (), 'Table'[Date Visit] = [MaxDate] )
)
DistinctCount =
VAR _currentItem =
MAX ( 'Table 2'[Item] )
RETURN
COUNTROWS ( FILTER ( ALL ( 'Table 2'[Item] ), 'Table 2'[Item] = _currentItem ) )
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you, works perfectly!
One more question.
Is it possible if i add slicer for year and month, when selecting a specific month it dynamically to calculate distinct count for the items based on the maximum date for that month?
Hello friend,
I have tried the same formula you mentioned...its working....sharing the snaps
Please let me know the problem you are facing.
I want to use ut in matrix visualisation but there it shows 1 against item 3 and I expect it to be empty
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.