Forum Discussion

heetu24's avatar
heetu24
Icon for Helper I rankHelper I
2 years ago
Solved

Need Urgent Help on DAX

I have 2 slicer one Slicer is for year. Where 3 filters TY, YA, 2YA. And another slicer is Period. MAT, QTR and YTD. Each Period  MAT, QTR & YTD represent TY, YA and 2YA. I have  created 6 measure   ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi heetu24 ,

     

    You can modify your formula like below:

    MAT_TY_VS_YA_Growth = DIVIDE(
        CALCULATE(SUM('FactTable'[SalesValue]), 'FactTable'[Period] = "TY", 'FactTable'[TimeGroup] = "MAT") - 
        CALCULATE(SUM('FactTable'[SalesValue]), 'FactTable'[Period] = "YA", 'FactTable'[TimeGroup] = "MAT"),
        CALCULATE(SUM('FactTable'[SalesValue]), 'FactTable'[Period] = "YA", 'FactTable'[TimeGroup] = "MAT")
    )
    MAT_YA_VS_2YA_Growth = DIVIDE(
        CALCULATE(SUM('FactTable'[SalesValue]), 'FactTable'[Period] = "YA", 'FactTable'[TimeGroup] = "MAT") - 
        CALCULATE(SUM('FactTable'[SalesValue]), 'FactTable'[Period] = "2YA", 'FactTable'[TimeGroup] = "MAT"),
        CALCULATE(SUM('FactTable'[SalesValue]), 'FactTable'[Period] = "2YA", 'FactTable'[TimeGroup] = "MAT")
    )
    DynamicGrowth = SWITCH(
        TRUE(),
        [SelectedYear] = "TY" && [SelectedPeriod] = "MAT", [MAT_TY_VS_YA_Growth],
        [SelectedYear] = "YA" && [SelectedPeriod] = "MAT", [MAT_YA_VS_2YA_Growth],
        BLANK()
    )

     

     


    Best Regards,
    Adamk Kong

     

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