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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
SebKaliVith
Regular Visitor

Average conditioned

Hello everyone,

 

I come back here because i got great answers last time i ask my questions here.

 

I would like to solve the problematic following :

 

I have two data tables in PBI. They are linked to each other with two columns key.

This is like :

 

 

Table 1
IDHospital
Key1A
Key2B
Key3C
Key4D

 

 

TABLE 2
IDPhaseTake into accountprogress
Clé 1P1120%
Clé 1P2110%
Clé2P1180%
Clé2P1110%
Clé2P2015%
Clé3P1160%
Clé4P1170%

 

I would like to :

For each hospital, find the average of the progress by phases, with only activites flagged by 1 (activites to take into account).

Imo, it's an average of the progresse on the Table 1, conditioned by phases and by the column "Take into account". But, i am a beginner in DAX, and i don't knwo how to do it !

 

Results should be :

 

 

RESULTS
HospitalPhasesProgress
AP120%
AP210%
BP145%
BP2-
CP160%
CP2-
DP170%
DP2-

 

Can Someone give me clue to find these progress average ?

 

 

Thank you for your help ! 

 

Séb

2 REPLIES 2
Greg_Deckler
Super User
Super User

Did something go haywire in the posting? Is the ID in Table 2 supposed to match the ID in Table 1? Key1, Key2...? 



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Assuming the answer is yes, perhaps:

 

AverageProgress = 
VAR __tmpTable = FILTER('Progress',[Take into account]=1)
RETURN AVERAGEX(__tmpTable,[progress])

Put into a table along with Hospital and Phase. Make sure Hospital and Phase are related based on [ID] columns.

 

 



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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