Forum Discussion

merryseeker's avatar
merryseeker
Frequent Visitor
8 years ago
Solved

new column from existing measures

Please see image below.  The last three columns on the right are measures that provide averages by our production day of week based on production date range selected in relative slicer. The figures that display here are correct. Now I simply want to use those measures in a new column  based on the WeekdayNum - something like this - no aggregates needed:

 

AvgbyDOW = IF(CPwithFuturePullDate[WeekdayNum]=2,[AvgCrtnsTu],IF(CPwithFuturePullDate[WeekdayNum]=4,[AvgCrtnsTh],[AvgCrtnsSat])

 

How might this be accomplished? 

It seems like it should be simple but I can't seem to find a solution that works. Thanks for your help! 

 

 

 

 

 

 

  • HI merryseeker

     

    Try this MEASURE

     

    AvgbyDOW =
    VAR myweek =
        SELECTEDVALUE ( CPwithFuturePullDate[WeekdayNum] )
    RETURN
        SWITCH (
            TRUE (),
            myweek = 2, [AvgCrtnsTu],
            myweek = 4, [AvgCrtnsTh],
            [AvgCrtnsSat]
        )

3 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    HI merryseeker

     

    Try this MEASURE

     

    AvgbyDOW =
    VAR myweek =
        SELECTEDVALUE ( CPwithFuturePullDate[WeekdayNum] )
    RETURN
        SWITCH (
            TRUE (),
            myweek = 2, [AvgCrtnsTu],
            myweek = 4, [AvgCrtnsTh],
            [AvgCrtnsSat]
        )
    • merryseeker's avatar
      merryseeker
      Frequent Visitor

      Thanks so much Zubair_Muhammad! This worked after I deactivated a relationship that I apparently did not need to have active.

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    When you say new column, you mean new measure correct? The issue I foresee depending on how your measures are calculated is that if you put them into a new calculated column in your table then they are going to be constrained by that row context and I'm thinking perhaps not give you what you are expecting.