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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
PBI_learner0
Frequent Visitor

Display value of columns with if condition

What is the correct dax for displaying the values of the columns?

This is the measure that i did, but it's not displaying any values.

 

Hours = IF([DaysBetween] > 30, SELECTEDVALUE('Table'[MonthlyWorkingHrs]), [BusinessDays] * SELECTEDVALUE('Table'[DailyWorkingHrs]))
5 REPLIES 5
ryan_mayu
Super User
Super User

could you pls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I want to display the value of monthly working hours if the dates between is greater than 30 days. but if the days between is less than that, i want to multiply the daily hours and the business days (already calculated)

how to identify greater than 30 days or not? it's better to provide some sample data, otherwise it's not easy to provide the proper solution.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




BusinessDays = NETWORKDAYS(MIN('Table'[Dates]), MAX('Table'[Dates]),1)
DaysBetween = DISTINCTCOUNT('Table'[Dates])
PBI_learner0_0-1710982417591.png

 

Hi @PBI_learner0 

 

You may try replacing SELECTEDVALUE function with MAX. Not sure whether your data table has multiple distinct values in MonthlyWorkingHrs and DailyWorkingHrs columns. If so, this is probably the cause. 

Hours =
IF (
    [DaysBetween] > 30,
    MAX ( 'Table'[MonthlyWorkingHrs] ),
    [BusinessDays] * MAX ( 'Table'[DailyWorkingHrs] )
)

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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