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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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