Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
merryseeker
Frequent Visitor

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? 

measureshelp.jpg

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

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

HI @merryseeker

 

Try this MEASURE

 

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

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Zubair_Muhammad
Community Champion
Community Champion

HI @merryseeker

 

Try this MEASURE

 

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

Regards
Zubair

Please try my custom visuals

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.