Forum Discussion

mohitchugh's avatar
mohitchugh
Frequent Visitor
2 years ago
Solved

Dynamic Measure Required with two slicer

Hi Folks,   I'm trying to develop the dashboard by comparing two months and their uses of two slicers.   I prepared the dashboard using Excel Formulas. please help to develop Power-BI As the Raw...
  • Jihwan_Kim's avatar
    2 years ago

    Hi, I could not access to the googledrive, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file whether it suits your requirement.

     

     

     

    Fix: = 
    CALCULATE (
        SUM ( Data[Value] ),
        REMOVEFILTERS ( Period ),
        Period[Period Number] = 0
    )
    

     

    Selected period: = 
    SUM( Data[Value])

     

     

    OFFSET function (DAX) - DAX | Microsoft Learn

     

    Previous period: = 
    VAR _previousperiodnumber =
        MAX ( Period[Period Number] ) - 1
    VAR _condition = _previousperiodnumber <> 0
    RETURN
        IF (
            _condition,
            CALCULATE (
                SUM ( Data[Value] ),
                OFFSET (
                    -1,
                    ALL ( Period[Period Number], Period[Period] ),
                    ORDERBY ( Period[Period Number], ASC )
                )
            )
        )

     

    Selected period fix: = 
    [Selected period:] - [Fix:]

     

    Diff: = 
    [Selected period:] - [Previous period:]