cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abukapsoun
Helper V
Helper V

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!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

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])



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Hi,

 

both did not work

 

@abukapsoun , expected output.

 

refer if file after signature can help



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

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

 

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



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

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!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

@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))



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors