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
johmedrano
Frequent Visitor

Distinct Count of Categories

Hello,

In Power BI I do have a visualization like this

 

Column from

Date Table

Column from Sales TableColumn from Product TableColumn from Sales TableColumn from Sales Table
DateProductCategoryPartner IDRevenue
JanuaryA1AX2323
JanuaryB1BY24342
JanuaryB1DX343443
JanuaryC1BX3434
JanuaryB1BY34343
FebruaryC1CY3434
FebruaryD3DY343
FebruaryA1AX4234
FebruaryB1BX34343
FebruaryC2CX3434
     

 

And I would like to create a measure "#Average per Active Partner" that returns the average number or Categories sold per ACTIVE Partner. ACTIVE Partner =  Revenue >0


Date# Average per Active Partner
January1.5
February2.5

 

Could you kindly advise on the DAX formula to use in this case ?

 

Thanks a lot for your patience and support.

2 ACCEPTED SOLUTIONS
Yggdrasill
Responsive Resident
Responsive Resident

Try this measure


 

#ActivePartners = 
VAR _countPartnerID = DISTINCTCOUNT( SalesTable[Partner ID] )
VAR _countCategory =  DISTINCTCOUNT( SalesTable[Category] )  
RETURN
   CALCULATE( 
       DIVIDE( _countCategory ; _countPartnerID ) ; FILTER( SalesTable ; SalesTable[Revenue] > 0 )    
   )

 

measure.PNG

View solution in original post

Vvelarde
Community Champion
Community Champion

@johmedrano

 

Hi, try with this measure:

 

Average per Partner =
VAR DistinctCategories =
    CALCULATE (
        DISTINCTCOUNT ( 'Product Table'[Category] );
        FILTER ( SalesTable; SalesTable[Revenue] > 0 )
    )
VAR ActivePartners =
    CALCULATE (
        DISTINCTCOUNT ( SalesTable[Partner ID] );
        FILTER ( SalesTable; SalesTable[Revenue] > 0 )
    )
RETURN
    DIVIDE ( DistinctCategories; ActivePartners )

Regards

 

Victor

Lima - Peru

 

 




Lima - Peru

View solution in original post

3 REPLIES 3
Vvelarde
Community Champion
Community Champion

@johmedrano

 

Hi, try with this measure:

 

Average per Partner =
VAR DistinctCategories =
    CALCULATE (
        DISTINCTCOUNT ( 'Product Table'[Category] );
        FILTER ( SalesTable; SalesTable[Revenue] > 0 )
    )
VAR ActivePartners =
    CALCULATE (
        DISTINCTCOUNT ( SalesTable[Partner ID] );
        FILTER ( SalesTable; SalesTable[Revenue] > 0 )
    )
RETURN
    DIVIDE ( DistinctCategories; ActivePartners )

Regards

 

Victor

Lima - Peru

 

 




Lima - Peru

@Vvelarde: My thinking exactly ... lol

Yggdrasill
Responsive Resident
Responsive Resident

Try this measure


 

#ActivePartners = 
VAR _countPartnerID = DISTINCTCOUNT( SalesTable[Partner ID] )
VAR _countCategory =  DISTINCTCOUNT( SalesTable[Category] )  
RETURN
   CALCULATE( 
       DIVIDE( _countCategory ; _countPartnerID ) ; FILTER( SalesTable ; SalesTable[Revenue] > 0 )    
   )

 

measure.PNG

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