Forum Discussion

aghtyson's avatar
aghtyson
Frequent Visitor
2 years ago
Solved

percentage

I have my calculations but one month is not working correctly.  Jan Feb and Mar should be divided by three - Jan and Feb are correct but March is not.  We added some department in April so that is wh...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi,aghtyson 

    As I understand it, your requirement is to return A1 results in the first three months, A2 results in April, and A3 results in May.

    Regarding the issue you raised, my solution is as follows:

    1.First I have created the following table and the column names and data are the data you have given:

    2. Below are the measure I've created for your needs:

     

    Measure = 
    VAR P1=CALCULATE([Total %],FILTER(ALLSELECTED(AuditDatebase2),'AuditDatebase2'[Department]="DF1 Zone1 Thru 3"))
    VAR P2=CALCULATE([Total %],FILTER(ALLSELECTED(AuditDatebase2),'AuditDatebase2'[Department]="DF1 Zone1 Thru 6"))
    VAR P3=CALCULATE([Total %],FILTER(ALLSELECTED(AuditDatebase2),'AuditDatebase2'[Department]="DF1(Zone 1F1)200-207"))
    VAR P4=CALCULATE([Total %],FILTER(ALLSELECTED(AuditDatebase2),'AuditDatebase2'[Department]="DF1 Z1-Z3 (800-822)"))
    VAR P5=CALCULATE([Total %],FILTER(ALLSELECTED(AuditDatebase2),'AuditDatebase2'[Department]="DF1 Z4- Z6 (824-896)"))
    VAR A1=FORMAT((P1+P2+P3)/3,"0%")
    VAR A2=FORMAT((P1+P2+P3+P4)/4,"0%")
    VAR A3=FORMAT((P1+P2+P3+P4+P5)/5,"0%")
    RETURN IF(MONTH(MAX('tblEvaluationSectionScores'[DateSumbmitted]))<=3,A1,
    IF(MONTH(MAX('tblEvaluationSectionScores'[DateSumbmitted]))=4,A2,
    IF(MONTH(MAX('tblEvaluationSectionScores'[DateSumbmitted]))=5,A3)))
    

     

    3.A relationship is established between the tables:

    4.Here's my final result, which I hope meets your requirements.

     

    Would it be possible to provide sample data and sample output in tabular format if my results don't meet your needs?Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

    Best Regards,

    Leroy Lu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.