Forum Discussion

TylerP's avatar
TylerP
New Member
3 years ago

Calculating a % increase whilst using slicers

Hello, 

 

I have a card in Power BI with the following measure - which calculates the % difference between two selected quarters on a slicer, the % becomes innnacuarte as soon as i select two quarters on different years on the slicer as the calculation is only recognizing the quarter number - is there any way i can add a layer to get the calculation to recognize the year also? I have tried .[Year].[Quarter] however that solution seems too simple and isn't accepted.

 

Variance INC =

VAR Month1 = CALCULATE([Count of Product total for Product],FILTER(ALLSELECTED('Dazil_New2'[Effective from].[Quarter]), Dazil_New2[Effective from].[Quarter]=MAX('Dazil_New2'[Effective from].[Quarter])))

VAR Month2 = CALCULATE([Count of Product total for Product],FILTER(ALLSELECTED('Dazil_New2'[Effective from].[Quarter]), Dazil_New2[Effective from].[Quarter]=MIN('Dazil_New2'[Effective from].[Quarter])))

RETURN

(Month1/Month2)

 

 

 

*I'm extremely new to Power BI so any help is greatly apprechiated.

2 Replies

  • v-zhangti's avatar
    v-zhangti
    Community Support

    Hi, TylerP 

     

    Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures. I look forward to your response.

     

    Best Regards,

    Community Support Team _Charlotte

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

    • TylerP's avatar
      TylerP
      New Member

      Hi Charlotte,

       

      I would like to produce a calculation that shows the % increase or decrease of the count of a product over a period of time defined by the timeframe slicer. First Year/quater selected to final year/quater selected. Currently i have a month variation which works if i select only quaters in one year, however the calculation doesn't produce an expected result as soon as i go further back e.g the whole of 2021-2022 is a count of products 769, reduced to 11, this should be -99%. Do you have any advice?

       

       

       

      I'm unsure how i go about adding sample data to this reply.

       

      Many thanks in advance,

      Tyler