Forum Discussion

powerbiwork's avatar
powerbiwork
Helper I
4 years ago
Solved

Dynamic Formula from Multiple Slicer

 Hi, 

 

I have the CPI in the same table, which have the year, month and CPI.

 

I am trying to create a calculator to calculate the difference of the CPI if different dates(start year, start month, end year, end month) are selected. 

I was able to pull the CPI value because I edited the interaction. But if I want to create a measure to subtract 273-259.10 based on the date slicers, would it be possible? 

 

Thanks so much in advance.

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi powerbiwork 

    It is impossible for you to create a measure to subtract 273-259.10 based on the date slicers .When you create a measure based on date slicers , the system cannot judge which slicer can be used ,because the fields for slicers all come from a field in your data table .

    Interaction just a visual effect , it doesn’t work in measure or calculated column .If you want to calculate the diff you must use separate data table and the date slicers that with different fields .

    I create a sample with separate data table .

    (1) Copy out a single data table .

    Table 2 = DISTINCT('Table')

    (2) Create different date slicers for different tables .

    (3)Create a measure to calculate the diff between the value from different slicers .

    diff = SELECTEDVALUE('Table 2'[Value])-SELECTEDVALUE('Table'[Value])

    The result is as shown :

    I have attached my pbix file ,you can refer to the page 2 in my pbix file .

     

    Best Regards

    Community Support Team _ Ailsa Tao

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi powerbiwork 

    It is impossible for you to create a measure to subtract 273-259.10 based on the date slicers .When you create a measure based on date slicers , the system cannot judge which slicer can be used ,because the fields for slicers all come from a field in your data table .

    Interaction just a visual effect , it doesn’t work in measure or calculated column .If you want to calculate the diff you must use separate data table and the date slicers that with different fields .

    I create a sample with separate data table .

    (1) Copy out a single data table .

    Table 2 = DISTINCT('Table')

    (2) Create different date slicers for different tables .

    (3)Create a measure to calculate the diff between the value from different slicers .

    diff = SELECTEDVALUE('Table 2'[Value])-SELECTEDVALUE('Table'[Value])

    The result is as shown :

    I have attached my pbix file ,you can refer to the page 2 in my pbix file .

     

    Best Regards

    Community Support Team _ Ailsa Tao

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