Forum Discussion

itsmeanuj's avatar
itsmeanuj
Icon for Helper IV rankHelper IV
3 years ago
Solved

Help in calculating total

Hi Guys,

I am looking for some help on one of the DAX calculation. Below is the sample data

VersionMonthValue
FYJan-23 $            92,447
FYFeb-23 $         8,74,925
FYMar-23 $       18,14,881
IPJan-23 $         7,17,083
IPFeb-23 $         7,17,083
IPMar-23 $         7,17,083

 

Expected Output - I want to show FY vs IP difference in the matrix format like below. Here is the DAX formula for FY vs IP

FY_vs_IP = abs(([Sum_of_FY]-[Sum_of_IP]))

 

 JanFebMarchTotalExpected Total
FY vs IP 6,24,636.68 1,57,841.97        10,97,797.82 6,31,003.10

   18,80,276.47

 

 

Now the problem is with the "Total" Calculation. i want it to calculate it as Sum(abs(Jan(FY)-Jan(IP)), abs(Feb(FY)-Feb(IP)),abs(March(FY)-March(IP))). However, the above DAX formula is giving me results as abs(sum(FY) - sum (IP))

Can someone please help in tweaking the formula to get the expected results?

Thanks,
Anuj

 

  • itsmeanuj Try something like:

    FY_IP_DIff Q1 =
    VAR __table = 
      SUMMARIZE(
        FILTER('2023 Data', [Month] IN { 1, 2, 3 }),
        [Time Period],
        "__value", abs([Sum_of_Actuals]-[Sum_of_IP]))
    RETURN
    IF(HASONEVALUE('2023 Data'[Time Period]),abs([Sum_of_Actuals]-[Sum_of_IP]),SUMX(__table,[__value]))

4 Replies