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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
EaglesTony
Post Prodigy
Post Prodigy

How do I do a distinct with DAX ?

Hi,

 

  I have the following:

NumberofFeaturesUnderSolutionEpic =
VAR varCurrentID = MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)]
VAR varFeatureCount =
    COUNTROWS(
        DISTINCT(
            SELECTCOLUMNS(
                FILTER(
                    MergeFinal,
                    MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)] = varCurrentID
                ),
                "@Features", MergeFinal[OnlyFeatures.FeatureKey]
            )
        )
    )
    RETURN
    varFeatureCount
 
There are 4 rows that have the same SolutionEpicKey, but I need to use only 1, thus distinct, as my calculation is showing 16 instead of 4.
 
I'm not sure where to put the DISTINCT and the syntax ????
VAR varCurrentID = DISTINCT(MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)])
OR do I use
FILTER(
                    MergeFinal,
                    DISTINCT(MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)]) = varCurrentID
 
But this syntax seems wrong, as there are 4 records in the table
1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@EaglesTony 

to get one value  :

use  max , min ... 
VAR varCurrentID = max(MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)])

 

if the MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)] is unique per each filter context,  then you have no problem, 

 

 

hope this helps .

View solution in original post

3 REPLIES 3
EaglesTony
Post Prodigy
Post Prodigy

Thank you!

Daniel29195
Super User
Super User

@EaglesTony 

to get one value  :

use  max , min ... 
VAR varCurrentID = max(MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)])

 

if the MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)] is unique per each filter context,  then you have no problem, 

 

 

hope this helps .

For some reason this isn't quite working:

 

 FILTER(
                    MergeFinal,
                    MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey)] = varCurrentID
 
MergeFinal[OnlyFeatures.FeatureParent(SolutionEpicKey) does not have the Key as 64, but for this ID, it is returning 1 instead of 0.
 
I think I need some logic as "WHERE MergeFinal[OnlyFeatures.FeatureKey]) IS NOT NULL ???

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors