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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Shruthi96
Helper III
Helper III

Dax Code for - getting unique count

Hi Friends, 

 

I am looking for the solution to get the unique count from the column list column which I have mentioned in the below snapshot.  Thanks in advance. 

 

Shruthi96_0-1648738047917.png

 

1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

 

MyMeasure =
VAR MyValues =
    ADDCOLUMNS( 'Table', "Paths", SUBSTITUTE( [Column1], ",", "|" ) )
VAR MyTable1 =
    SELECTCOLUMNS(
        GENERATE(
            MyValues,
            ADDCOLUMNS(
                GENERATESERIES( 1, PATHLENGTH( [Paths] ) ),
                "MyPaths", TRIM( PATHITEM( [Paths], [Value], TEXT ) )
            )
        ),
        "Paths", [MyPaths]
    )
VAR MyTable2 =
    ADDCOLUMNS( MyTable1, "Rank", RANKX( MyTable1, [Paths],,, DENSE ) )
RETURN
    MAXX( MyTable2, [Rank] )

 

Regards

View solution in original post

4 REPLIES 4
Jos_Woolley
Solution Sage
Solution Sage

Hi,

 

MyMeasure =
VAR MyValues =
    ADDCOLUMNS( 'Table', "Paths", SUBSTITUTE( [Column1], ",", "|" ) )
VAR MyTable1 =
    SELECTCOLUMNS(
        GENERATE(
            MyValues,
            ADDCOLUMNS(
                GENERATESERIES( 1, PATHLENGTH( [Paths] ) ),
                "MyPaths", TRIM( PATHITEM( [Paths], [Value], TEXT ) )
            )
        ),
        "Paths", [MyPaths]
    )
VAR MyTable2 =
    ADDCOLUMNS( MyTable1, "Rank", RANKX( MyTable1, [Paths],,, DENSE ) )
RETURN
    MAXX( MyTable2, [Rank] )

 

Regards

Thank you @Jos_Woolley  It worked. 🙂

You're welcome!

Regards

Shruthi96
Helper III
Helper III

I need the solution only from DAX code. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.