cancel
Showing results for
Did you mean:
Helper V

## Calculate distinct

Hi,

I have the following table

 HC Price X 350 X 350 X 350 Y 400 Y 400 Z 600 Z 600

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

Thanks,

1 ACCEPTED SOLUTION
Super User

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

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Mastering Power BI 2nd Edition
8 REPLIES 8
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 !!
Helper V

Hi,

both did not work

Super User

@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 !!
Helper V

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

Super User

@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 !!
Helper V
Still not working 😞
Super User

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

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Mastering Power BI 2nd Edition
Super User

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

Announcements