Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello!
I tried to to an answer to my issue in another post but I poorly described my issue. I would like to explain it better here.
Someone sent me a very complicated pbix to play with. Its creator is no more in the company. I'm not a data analyst so there are a lot of things I have trouble to understand.
My colleague wants me to get a table with the avg sales per user (row) per cycle (column). Fortunately, the creator of the file created all the formulas I needed to get this :
This is a Matrix table with this in it :
NOM_PRENOM is a column a of table, it is the names from a table with all employees in it
CYCLE_SEQ is a column a of table, is a predetermined cycle (like a season, a month, etc)
M_Billet_jour is a Measure. I can't give it here but it looks like this :
Solved! Go to Solution.
Unfortunately, I didn't understand your answer well enough to make it work.
All I get as a result is the same data :
In the meantime, I found a workaround that I would like to share here. I'm aware this is not what I asked for at first but the more time I spend on this problem, the more I understood the matrix visual wasn't required.
I did a table with custom measures that filter the cycles (each measure has its own cycle)
It's not as effective because this doesn't let the user filter the cycles by himself but it wasn't requested by the user.
The formula looks like this :
The formula for the average can certainly be optimized but my barebone knowledge made me do this :
M_Billet_jour_Moyenne_Globale =
var M_Billet_jour_Cycle1 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="1")),0,1)
var M_Billet_jour_Cycle2 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="2")),0,1)
var M_Billet_jour_Cycle3 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="3")),0,1)
var M_Billet_jour_Cycle4 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="4")),0,1)
var M_Billet_jour_Cycle5 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="5")),0,1)
var M_Billet_jour_Cycle6 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="6")),0,1)
var M_Billet_jour_Cycle7 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="7")),0,1)
var M_Billet_jour_Cycle8 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="8")),0,1)
var M_Billet_jour_Cycle9 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="9")),0,1)
var M_Billet_jour_Cycle10 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="10")),0,1)
var M_Billet_jour_Cycle11 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="11")),0,1)
var Diviseur = M_Billet_jour_Cycle1 + M_Billet_jour_Cycle2 + M_Billet_jour_Cycle3 + M_Billet_jour_Cycle4 + M_Billet_jour_Cycle5 + M_Billet_jour_Cycle6 + M_Billet_jour_Cycle7 + M_Billet_jour_Cycle8 + [M_Billet_Jour_Cycle9] + [M_Billet_Jour_Cycle10] + [M_Billet_Jour_Cycle11]
var Total = ([M_Billet_Jour_Cycle1] + [M_Billet_jour_Cycle2] + [M_Billet_jour_Cycle3] + [M_Billet_jour_Cycle4] + [M_Billet_jour_Cycle5] + [M_Billet_Jour_Cycle6] + [M_Billet_Jour_Cycle7] + [M_Billet_Jour_Cycle8] + [M_Billet_Jour_Cycle9] + [M_Billet_Jour_Cycle10] + [M_Billet_Jour_Cycle11])/Diviseur
RETURN Total
Hi @volt26 ,
According to your description, here are my steps you can follow as a solution.
(1) We can create a measure.
Measure =
VAR _a=SUMX(FILTER(ALLSELECTED('Table'),'Table'[NOM_PRENOM]=MAX('Table'[NOM_PRENOM])),[M_Billet_jour])
VAR _b=COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[NOM_PRENOM]=MAX('Table'[NOM_PRENOM]) && [M_Billet_jour] <>BLANK()))
RETURN DIVIDE(_a,_b)
(2) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Unfortunately, I didn't understand your answer well enough to make it work.
All I get as a result is the same data :
In the meantime, I found a workaround that I would like to share here. I'm aware this is not what I asked for at first but the more time I spend on this problem, the more I understood the matrix visual wasn't required.
I did a table with custom measures that filter the cycles (each measure has its own cycle)
It's not as effective because this doesn't let the user filter the cycles by himself but it wasn't requested by the user.
The formula looks like this :
The formula for the average can certainly be optimized but my barebone knowledge made me do this :
M_Billet_jour_Moyenne_Globale =
var M_Billet_jour_Cycle1 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="1")),0,1)
var M_Billet_jour_Cycle2 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="2")),0,1)
var M_Billet_jour_Cycle3 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="3")),0,1)
var M_Billet_jour_Cycle4 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="4")),0,1)
var M_Billet_jour_Cycle5 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="5")),0,1)
var M_Billet_jour_Cycle6 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="6")),0,1)
var M_Billet_jour_Cycle7 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="7")),0,1)
var M_Billet_jour_Cycle8 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="8")),0,1)
var M_Billet_jour_Cycle9 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="9")),0,1)
var M_Billet_jour_Cycle10 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="10")),0,1)
var M_Billet_jour_Cycle11 = IF(ISBLANK(CALCULATE([M_Billet_jour],D_DATE[CYCLE]="11")),0,1)
var Diviseur = M_Billet_jour_Cycle1 + M_Billet_jour_Cycle2 + M_Billet_jour_Cycle3 + M_Billet_jour_Cycle4 + M_Billet_jour_Cycle5 + M_Billet_jour_Cycle6 + M_Billet_jour_Cycle7 + M_Billet_jour_Cycle8 + [M_Billet_Jour_Cycle9] + [M_Billet_Jour_Cycle10] + [M_Billet_Jour_Cycle11]
var Total = ([M_Billet_Jour_Cycle1] + [M_Billet_jour_Cycle2] + [M_Billet_jour_Cycle3] + [M_Billet_jour_Cycle4] + [M_Billet_jour_Cycle5] + [M_Billet_Jour_Cycle6] + [M_Billet_Jour_Cycle7] + [M_Billet_Jour_Cycle8] + [M_Billet_Jour_Cycle9] + [M_Billet_Jour_Cycle10] + [M_Billet_Jour_Cycle11])/Diviseur
RETURN Total
User | Count |
---|---|
84 | |
80 | |
69 | |
46 | |
46 |
User | Count |
---|---|
106 | |
50 | |
49 | |
40 | |
39 |