Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Variance % in Line and Bar Stacked Bar

 

Hi All,

 

I'm triyng to populated the variance % for the below visual but not getting the desired result.

Ideally from 5 to10 it should show  then 100%( (10-5)/10) from 10 to16 it should show 60% ( 16-10/10) but the measure is not working for me.

 

Any help here?

 

 

Measure =
var _current=CALCULATE(
    [Assessment L6W_1],FILTER(ALL(VW_D_DATE),VW_D_DATE[WEEK_END_DATE]=MAX(VW_D_DATE[WEEK_END_DATE])))
var _pre=CALCULATE(
    [Assessment L6W_1],FILTER(ALL(VW_D_DATE),VW_D_DATE[WEEK_END_DATE]=MAX(VW_D_DATE[WEEK_END_DATE])-1))
var _percent=DIVIDE(_current-_pre,_pre,0)
return _percent

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    Try this:

    Measure = var _table=ADDCOLUMNS(SUMMARIZE(ALLSELECTED(VW_D_DATE),[WEEK_END_DATE]),"test",[Assessment L6W_1])
    var _pre= MAXX(FILTER(_table,[WEEK_END_DATE]=MAX(VW_D_DATE[WEEK_END_DATE])-7),[test])
    var _current=[Assessment L6W_1]
    var _percent=DIVIDE(_current-_pre,_pre,0)
    RETURN _percent

    Best Regards,

    Neeko Tang

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

     

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Please try to create three measures.

    Current=MAXX(FILTER(ALL(VW_D_DATE),VW_D_DATE[WEEK_END_DATE]=MAX(VW_D_DATE[WEEK_END_DATE])),[Assessment L6W_1])
    Pre=MAXX(FILTER(ALL(VW_D_DATE),VW_D_DATE[WEEK_END_DATE]=MAX(VW_D_DATE[WEEK_END_DATE])-1),[Assessment L6W_1])
    Percent=DIVIDE([Current]-[Pre],[Pre],0)
    

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

         

        Try this:

        Measure = var _table=ADDCOLUMNS(SUMMARIZE(ALLSELECTED(VW_D_DATE),[WEEK_END_DATE]),"test",[Assessment L6W_1])
        var _pre= MAXX(FILTER(_table,[WEEK_END_DATE]=MAX(VW_D_DATE[WEEK_END_DATE])-7),[test])
        var _current=[Assessment L6W_1]
        var _percent=DIVIDE(_current-_pre,_pre,0)
        RETURN _percent

        Best Regards,

        Neeko Tang

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