Forum Discussion

powerbi0718's avatar
powerbi0718
Icon for Microsoft Employee rankMicrosoft Employee
3 years ago

Dynamic calculation based on slicer selection to compare two months values

Hi,

 

I have been trying to work on this for quite some time but not able to find the solution:
I have a table like this in which there could be a change in state of the program every month. what i need is an additional column that could show the value based on the slicer selection.


Month YearProgramState
1/1/2023ABC01Charter
1/1/2023ABC02Charter
1/1/2023ABC03Closure
1/1/2023ABC04Cancelled
2/1/2023ABC01Charter
2/1/2023ABC02Charter
2/1/2023ABC03Closure
2/1/2023ABC04Cancelled
2/1/2023ABC05Approved
3/1/2023ABC01Charter
3/1/2023ABC02Charter
3/1/2023ABC03Closure
3/1/2023ABC04Cancelled
3/1/2023ABC05Approved
3/1/2023ABC06Charter
3/1/2023ABC07Approved



For example slicer selection is Jan 2023 and March 2023. My output should look like this :


Month YearProgramStatePrevMonthState
1/1/2023ABC01Charter 
1/1/2023ABC02Charter 
1/1/2023ABC03Closure 
1/1/2023ABC04Cancelled 
3/1/2023ABC01CharterCharter
3/1/2023ABC02CharterCharter
3/1/2023ABC03ClosureClosure
3/1/2023ABC04CancelledCancelled
3/1/2023ABC05Approved 
3/1/2023ABC06Charter 
3/1/2023ABC07Approved 

 

5 Replies

    • powerbi0718's avatar
      powerbi0718
      Icon for Microsoft Employee rankMicrosoft Employee

      its not always going to be previous month. depending upon what user is selecting it could be Jan 2023 and April 2023 or Jan 2023 and Feb 2023 or Feb 2023 and Aug 2023

      ThxAlot 

    • ThxAlot's avatar
      ThxAlot
      Icon for Super User rankSuper User

      amitchandak I dont' need your comment.

      Obviously, your formula is error-prone; if any other columns exists in the viz, it's damaged; ALLEXCEPT() is necessary.

      Anyway, talk to the thread initiator.

       

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        ThxAlot , Sorry about mentioning your name, when I initially typed the name I got confused because it showed two names and one blank update below. So I thought you were the tread owner. 

        I corrected the name just a couple of minutes back.