Forum Discussion
YTD Average - DAX calculation
Dear all,
I'm trying to calculate the YTD Average value - but I would need your help on this KPI & DAX language.
Data are like this:
-> Conformity level (Grade A = OK/NON OK per scan/factory/etc.).
So I would need to calculate the average of grade A/period and then make the average from the beginning of this year until a specified period (ex. P5 - or 31st May).
Here some data:
| year | month | day | CONFORMITY | Period | Factories |
| 2021 | 4 | 13 | OK | P04 | RCR |
| 2021 | 4 | 13 | OK | P04 | RCR |
| 2021 | 5 | 6 | OK | P05 | RDM |
| 2021 | 5 | 6 | OK | P05 | RDM |
| 2021 | 5 | 6 | OK | P05 | RDM |
| 2021 | 5 | 6 | OK | P05 | RDM |
| 2021 | 5 | 6 | OK | P05 | RDM |
| 2021 | 4 | 16 | OK | P04 | RCC |
| 2021 | 4 | 16 | OK | P04 | RCC |
| 2021 | 4 | 18 | OK | P04 | RCC |
| 2021 | 4 | 18 | OK | P04 | RCC |
| 2021 | 5 | 3 | OK | P05 | RCC |
| 2021 | 5 | 4 | OK | P05 | RCC |
| 2021 | 4 | 1 | OK | P04 | RGU |
| 2021 | 4 | 1 | OK | P04 | RGU |
| 2021 | 4 | 1 | OK | P04 | RGU |
| 2021 | 4 | 1 | OK | P04 | RGU |
| 2021 | 4 | 1 | CTRL_NOK | P04 | RGU |
| 2021 | 4 | 1 | OK | P04 | RGU |
| 2021 | 4 | 12 | WRNG_NOK | P04 | RGU |
| 2021 | 4 | 12 | WRNG_NOK | P04 | RGU |
| 2021 | 4 | 12 | OK | P04 | RGU |
| 2021 | 4 | 12 | OK | P04 | RGU |
| 2021 | 4 | 12 | OK | P04 | RGU |
| 2021 | 4 | 12 | OK | P04 | RGU |
| 2021 | 4 | 29 | OK | P05 | RGU |
| 2021 | 4 | 29 | OK | P05 | RGU |
| 2021 | 4 | 29 | OK | P05 | RGU |
| 2021 | 4 | 29 | OK | P05 | RGU |
| 2021 | 4 | 29 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | WRNG_NOK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | WRNG_NOK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
| 2021 | 5 | 14 | OK | P05 | RGU |
I would really appreciate your help.
Best regards
Hervé
PS: v-kelly-msft
Anonymous
pls try this
Measure = DIVIDE(CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[CONFORMITY]="OK")),COUNTROWS('Table'))Anonymous
pls change year to rclms_qa[year]
17 Replies
- ryan_mayu
Super User
Anonymous
could you pls provide the expected output?
- AnonymousNot applicable
Hello,
Expected output is the average of Grade A (Conforme products) / period. (ex. YTD -> From P1 (beginning of the year) until P4 (or now), the average of grade A from P1 to P4 (or now)).
Hope I'm clear
Thanks
Hervé
- ryan_mayu
Super User
Anonymous
could you pls provide the real output based on the sample data you provided? It will be better if you can provide the calculation logic as well.
- Syndicate_Admin
Administrator
Good morning, I press my name is pablo and I am from Argentina and I have a problem to get the average talk time of a telephone exchange, AHT calls, if I on the excel calculate with the average function that value gives me correctly but on power bi I do not find the turn, what I do is calculate the total time of conversation but I do not find the way to get that average, I attach a capture of what I have and if anyone can help me thank you very much.-
Best regards;
Pablo
- ryan_mayu
Super User