Forum Discussion

Mani_ms's avatar
Mani_ms
Helper I
6 years ago
Solved

Comparing Two period slicer selection

Hi ,

 

I have months under slicer and i want to arrive difference between two selected period based on the selection.

(Based on the latest month selcted and selected previous period)

 

Arriving perivious period value i am having zero with below dax calculatrion. can anyone help me out.

 

Previous period calculation i am not getting right values.

 

 

Thanks,

Mani

 

 

  • Hi Mani_ms ,

    I found that you filtered the group = BS in the matrix so I created a slicer for the group field and the following measure if I got it correctly:

    Measure = 
    VAR _group =
        SELECTEDVALUE ( 'FMA 011 CY'[Group] )
    VAR _maxfis =
        CALCULATE (
            MAX ( 'FMA 011 CY'[Fiscal Year/Period] ),
            ALLSELECTED ( 'FMA 011 CY'[Fiscal Year/Period] )
        )
    VAR _minfis =
        CALCULATE (
            MIN ( 'FMA 011 CY'[Fiscal Year/Period] ),
            ALLSELECTED ( 'FMA 011 CY'[Fiscal Year/Period] )
        )
    VAR _max =
        CALCULATE (
            SUM ( 'FMA 011 CY'[Balance - Cumulative] ),
            'FMA 011 CY'[Group] = _group,
            'FMA 011 CY'[Fiscal Year/Period] = _maxfis
        )
    VAR _min =
        CALCULATE (
            SUM ( 'FMA 011 CY'[Balance - Cumulative] ),
            'FMA 011 CY'[Group] = _group,
            'FMA 011 CY'[Fiscal Year/Period] = _minfis
        )
    RETURN
        _max - _min

    Attached sample file: fille.pbix 

     

    Best Regards,
    Yingjie Li

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

12 Replies