Forum Discussion

dapperscavenger's avatar
7 years ago
Solved

How to handle measures in a chart?

Hi   I have a chart based on a table of historical weekly data.  The measures Green, Red and White are used in the stacked column chart.   Additionally I have four measures that I've created to s...
  • dapperscavenger's avatar
    7 years ago

    Okay, so I figured out a way to union the measures in a table

     

    WeekProj = 
    VAR
    	TW = (sum(Projections[Demand This Week])+ sum(Projections[OOS This week]))/ sum(Projections[Demand This Week])
    VAR
    	TW1 = (sum(Projections[Demand TW + 1])+ sum(Projections[OOS TW + 1]))/ sum(Projections[Demand TW + 1])
    VAR
    	TW2 = (sum(Projections[Demand TW + 2])+ sum(Projections[OOS TW + 2]))/ sum(Projections[Demand TW + 2])
    VAR
    	TW3 = (sum(Projections[Demand TW + 3])+ sum(Projections[OOS TW + 3]))/ sum(Projections[Demand TW + 3])
    RETURN
    UNION (
        ROW( "Week", "% TW", 
    "KPI % Proj Chart", TW, 
    "ProjGreen", IF(TW>0.986,TW-0.986,0), 
    "ProjRed", IF(TW<0.986,0.986-TW,0),  
    "ProjWhite", IF(TW>=0.986,0.986,TW)
     ),
        ROW( "Week", "% TW+1", 
    "KPI % Proj Chart", TW1, 
    "ProjGreen", IF(TW1>0.986,TW1-0.986,0), 
    "ProjRed", IF(TW1<0.986,0.986-TW1,0),  
    "ProjWhite", IF(TW1>=0.986,0.986,TW1)
     ),
        ROW("Week", "% TW+2", 
    "KPI % Proj Chart", TW2, 
    "ProjGreen", IF(TW2>0.986,TW2-0.986,0), 
    "ProjRed", IF(TW2<0.986,0.986-TW2,0),  
    "ProjWhite", IF(TW2>=0.986,0.986,TW2)
     ),
        ROW( 
    "Week", "% TW+3", 
    "KPI % Proj Chart", TW3, 
    "ProjGreen", IF(TW3>0.986,TW3-0.986,0), 
    "ProjRed", IF(TW3<0.986,0.986-TW3,0),  
    "ProjWhite", IF(TW3>=0.986,0.986,TW3)
    )

    I put the ProjGreen, ProjWhite and ProjRed in a similar stacked bar chart and put them side by side

     

    I could probably have unioned the history and projections but in the end this will do the job :)