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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
electrobrit
Post Patron
Post Patron

conditional statement by name for weekly totals

I am trying to get total available hours by week which is usually 40 but one person works 20.
In trying to get this in the table by person by week
Is there a conditional statement I can use?
if name is John then 5*4, else 5*8
I've tried a few thing (like this below) and when I add to table with dates by week and names of everyone, I get 87160 instead of 20 for john and 40 for everyone else. Any ideas?

Column = SUMX('-AvailHours', SWITCH(TRUE(),
'-AvailHours'[narrative_full_name]="John", 5*4,8*4))

electrobrit_2-1664486810002.png

 


 


 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @electrobrit ,

Try

    Working Hours = 

    SWITCH(
        TRUE(),
        SELECTEDVALUE(Sheet1[Name]) = "John",20,40)


BR

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @electrobrit ,

Try

    Working Hours = 

    SWITCH(
        TRUE(),
        SELECTEDVALUE(Sheet1[Name]) = "John",20,40)


BR

Dinesh_Suranga
Continued Contributor
Continued Contributor

@electrobrit

Hi,

Use following DAX formula.

Column = IF(SELECTEDVALUE(-AvailHours[narrative_full_name]) = "John", 5*4,5*8)
If it works, Please accept it as solution.

Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors