Forum Discussion

medaxing's avatar
medaxing
Frequent Visitor
4 years ago
Solved

Grand Totals Rows and Column Not Matching

Hi Guys,

 

Greetings!

 

Need your help.

Below is the example of the data. Unfortunately unable to figure out why the grand totals are not matching.

 

Name

2022-01

2022-02

2022-03

Total

P1

-308200

 

-39563

-65000

P2

-342529

-39563

 

-760000

P3

-442792

 

 

-389900

P3

-442792

-20000

-39563

-68000

Total

-200000

-45000

-30000

???

 

below is my dax:

 

measure_base =
if(calculate('T1'[MMM1],'T2'[L2]<>"Hire",'AU'[AU]="CDC"||'AU'[AU]="CDS")* [Cal_C]<
calculate('T1'[MMM1],'T2'[L2]<>"Hire",'AU'[AU]="CDC"||'AU'[AU]="CDS"),
calculate('T1'[MMM1],'T2'[L2]<>"Hire",'AU'[AU]="CDC"||'AU'[AU]="CDS"),
calculate('T1'[MMM1],'T2'[L2]<>"Hire",'AU'[AU]="CDC"||'AU'[AU]="CDS")* [Cal_C])

 

final_measure:
if(hasonefilter('Calendar'[Year and Month]),if(HASONEFILTER('V'[V Code]),
if([measure_base]<1,0,[measure_base]),
sumx(V,[measure_base])
))

 

Could you please help.

 

Thanks in advance.

  • Hi medaxing ,

     

    Please try the following formula:

     

    Measure = 
    var total = 
        sumx (
            SUMMARIZE ( V, 'Calendar'[Year and Month], V[V Code], "base", [measure_base] ),
            [base]
        )
    return
        if (
            hasonefilter ( 'Calendar'[Year and Month] ) && HASONEFILTER ( 'V'[V Code] ) ,
            if ( [measure_base] < 1, 0, [measure_base] ),
            total
        )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.

  • v-kkf-msft's avatar
    v-kkf-msft
    Community Support

    Hi medaxing ,

     

    Please try the following formula:

     

    Measure = 
    var total = 
        sumx (
            SUMMARIZE ( V, 'Calendar'[Year and Month], V[V Code], "base", [measure_base] ),
            [base]
        )
    return
        if (
            hasonefilter ( 'Calendar'[Year and Month] ) && HASONEFILTER ( 'V'[V Code] ) ,
            if ( [measure_base] < 1, 0, [measure_base] ),
            total
        )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.