Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
agd50
Helper V
Helper V

Filter (DistinctCount) - DAX Newbie

agd50_0-1689296797810.png


Hey forum,
I want to be able to create a measure that aggregates as a DistinctCount but only shows the value for the current year (including if I check in a year from now).

Please Help, Thanks

(censored for privacy reasons)

1 ACCEPTED SOLUTION
Kishore_KVN
Solution Sage
Solution Sage

Hello @agd50 ,

you can use below calculation to achieve this:

Calculate(DistinctCount(Column), filter(Table, Year(Table[Date])= Year(Today())))

 

If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

View solution in original post

4 REPLIES 4
agd50
Helper V
Helper V

Count of x YTD =
    CALCULATE (
        DISTINCTCOUNT ( 'x'[x] ),

        FILTER (RELATEDTABLE(Dim_Calendar), YEAR(Dim_Calendar[Date])=YEAR(TODAY()
        )
    )
)

This worked exactly how I wanted it to, Thanks
Kishore_KVN
Solution Sage
Solution Sage

Hello @agd50 ,

you can use below calculation to achieve this:

Calculate(DistinctCount(Column), filter(Table, Year(Table[Date])= Year(Today())))

 

If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

I agree thanks, but I assume that calculate is not neccessary in measures as that is already automatically included

On second thought this may not work for me as I forgot to mention dim_calendar is a separate table to the aggregation so I assume that a related/relatedtable which need to be included somewhere

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.