Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Dynamic calculate Measure value based on Slicer Selection

Hi everyone! 

 

I hope, that you can help me, because I'm new in power bi world))))

 

I need to create a table, where I can add measures by choosing atributes in slicer and compare theese measure, for example YoY (see pic below - "Volume" is chosen by filter in slicer) .

 

 

 

 

 

 

 

 

I managed to create table based on dynamically calsulated measures and slicer selection (the example is described here - https://community.powerbi.com/t5/Desktop/Changing-column-graph-displayed-value/m-p/108427/highlight/true#M45588).

 

Unfortunately, I'm not succed in comparing measures (YoY %). 

Can someone help me, plese? 

 

 

4 Replies

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    Hi oksana,

     

    As a general solution, maybe you can try measure below and check if it can meet your requirement:

     

    YoY% =
    VAR value_A =
        CALCULATE ( MAX ( table[value] ), FILTER ( table, table[year] = 2017 ) )
    VAR value_B =
        CALCULATE ( MAX ( table[value] ), FILTER ( table, table[year] = 2018 ) )
    RETURN
        CALCULATE ( ( value_B - value_A ) / value_A, ALLSELECTED ( table[Product] ) )
    

    In addtion, if you have other issues, could you share some sample data and share more details about your logic and expected results?

     

    Regards,

    Jimmy Tao

  • Anonymous's avatar
    Anonymous
    Not applicable

     

    v-yuta-msft and Greg_Deckler,

     

    thank you very much for you advices! I will use them for sure.

     

    But unfortunately, I can not solve my task

    I have attached more details, hoping on  your help :)

     

    I have table with columns Product, NetSales, Volume and Year. I need filters,that will help User to choose what type of measure he wants to see in table/chart. I managed to do filters, but I do not know how to make filter, pushing on which (it will appear new column) i can see comparisson of two years in percentage (YoY).

     

    Do you have any idea?