Forum Discussion

SebKaliVith's avatar
SebKaliVith
Regular Visitor
8 years ago

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

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

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

    • Greg_Deckler's avatar
      Greg_Deckler
      Community Champion

      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.