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 data is attached Excel is available. please refer it

 

Google Drive Link for Excel File 

 

Please feel free to contact for more info if required.

 

RAW Data

PeriodAccountValue XValue YValue Z
FixTata435
FixBirla678
FixAdani789
FixRIL8910
FixTata91011
FixBirla101112
JanAdani111213
JanRIL121314
JanTata131415
JanBirla141516
JanAdani151617
FebRIL161718
FebTata171819
FebBirla181920
FebAdani192021
FebRIL202122
MarchTata212223
MarchBirla222324
MarchAdani232425
MarchRIL242526
MarchTata252627
MarchBirla262728
MarchAdani272829
AprilRIL282930
AprilTata293031
AprilBirla303132
AprilAdani313233
AprilRIL323334
AprilTata333435

 

Regards,

MOHIT

  • 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:]

2 Replies

  • 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:]