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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
abukapsoun
Post Patron
Post Patron

Calculate distinct

Hi,

I need your expertise please

 

I have the following table

 

HCPrice
X350
X350
X350
Y400
Y400
Z600
Z600

 

 

How can I compute the average price taking into consideration distinct HCs and not all of them?

 

Thanks,

 

1 ACCEPTED SOLUTION

@abukapsoun - Seems like this should be:

Measure 29 = 
    VAR __Table = SUMMARIZE('Table (29)',[HC],"Average",AVERAGE([Price]))
RETURN
    AVERAGEX(__Table,[Average])

Attached PBIX below sig, Page 29.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@abukapsoun , Try a measure like

averageX(values(Table[HC]), max(Table[Price]))

or

averageX(Summarize(Table, Table[HC],"_1", max(Table[Price])), [_1])

Hi,

 

both did not work

 

@abukapsoun , expected output.

 

refer if file after signature can help

I am expecting (350+400+600)/3

 

@abukapsoun ,Please find the attached file after the signature . I think that 450 . refer Avg2, Avg 3

Still not working 😞

@abukapsoun - Seems like this should be:

Measure 29 = 
    VAR __Table = SUMMARIZE('Table (29)',[HC],"Average",AVERAGE([Price]))
RETURN
    AVERAGEX(__Table,[Average])

Attached PBIX below sig, Page 29.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@abukapsoun , what is not working, I can see 450 in card, do you need that at each line ?

 

Calculate(averageX(Summarize(Table, Table[HC],"_1", max(Table[Price])), [_1]) , all(Table))

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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