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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Column subtotal having distinctcount values

Hey guys, 

 

Immediate request, 

 

I have a matrix table, I'm using distinct count for my column(Hours column). I would need to sum column subtotal (5, 7,9,7,8) =36

 

Pls help! 

IMG_20200716_150358.jpg

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please reference this to have a try.

(Replace "Product" with your "Hour" column)

 

Distinct count =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Product] ),
    ALLSELECTED ( 'Table'[Date].[Month] )
)
Total values =
VAR t =
    SUMMARIZE (
        'Table',
        'Table'[Date].[Month],
        'Table'[Product],
        "distinct count", [Distinct count]
    )
RETURN
    SUMX ( t, [Distinct count] )

 

v-xuding-msft_0-1594968454820.png

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , you should give a better screenshot and date

 

You have try like

sumx(summarize(Table, Table[row],table[col],"_1",distinctCOUNT(Table[Col1])),[_1])

 

Here Table[row],table[col] are your group by , you have given in matrix row and column, They can be one or many as per need

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

apologies for the screenshot.

 

i did use your measure but seems like it not solving my purpose.

attaching the SC, left is with the help of measure you suggessted, right one is original. I need unique hour counts but it seems like with the measure it counting the hours.Screen.jpg

 

Anonymous
Not applicable

@amitchandak have attached the SC above

Hi @Anonymous ,

 

Please reference this to have a try.

(Replace "Product" with your "Hour" column)

 

Distinct count =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Product] ),
    ALLSELECTED ( 'Table'[Date].[Month] )
)
Total values =
VAR t =
    SUMMARIZE (
        'Table',
        'Table'[Date].[Month],
        'Table'[Product],
        "distinct count", [Distinct count]
    )
RETURN
    SUMX ( t, [Distinct count] )

 

v-xuding-msft_0-1594968454820.png

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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