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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.