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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sree_12
Frequent Visitor

Calculate Average of Distinct count values by summarizing columns(Need Measure or Column not table)

Hello Team,

I need your suggestions in  creating Average value for Distinct count of ID's after summarizing three columns in a table.

IDCategoryCodeDateSubjectType
1AX7/20/2020ABCSales
1AY7/21/2020ABCSales
2BZ7/20/2020DEFPurchase
3BZ7/22/2020DEForder
4BZ7/23/2020XYZorder

 

What I need is to Create Calculated column/ measure which gets Average of distinct count of ID column after summarizing Category, code, date, subject columns.

Please suggest me dax code for this,

Thank you,

6 REPLIES 6
amitchandak
Super User
Super User

@sree_12 , depending on the need

averageX(summarize(Table,Table[Category],Table[code],Table[date], Table[Subject],"_1",distinctCOUNT(Table[ID])),[_1])
averageX(summarize(Table,Table[Category],Table[code],Table[date],"_1",distinctCOUNT(Table[ID])),[_1])

averageX(summarize(Table,Table[Category],"_1",distinctCOUNT(Table[ID])),[_1])
averageX(summarize(Table,Table[code],Table[date],"_1",distinctCOUNT(Table[ID])),[_1])
averageX(summarize(Table,Table[date], Table[Subject],"_1",distinctCOUNT(Table[ID])),[_1])

 

 

Thank you @amitchandak 

I am not getting expected result when I apply this solution to my report


Thanks you

Hi @sree_12 ,

 

 

Can you share the expected output ?

 

Regards,

Harsh Nathani

mahoneypat
Employee
Employee

Please try this in a measure expression

 

Avg ID Count =
AVERAGEX (
SUMMARIZE ( Table, Table[Category], Table[Code], Table[Date], Table[Subject] ),
CALCULATE ( DISTINCTCOUNT ( Table[ID] ) )
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


mahoneypat
Employee
Employee

You can use this formula to get your results

 

ID DistinctCount = CALCULATE(Distinctcount(Table[ID]), ALLEXCEPT(Table, Table[ID], Table[Type]))

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you @mahoneypat .

But I need to calculate average(Distinctcount(Table[ID])) after summarizing above mentioned columns.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors