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.
IF(DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])>5
AND DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])<=10 )
then
'6-10 Days'
ELSEIF (DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])>=4
AND DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])<=5)
then
'4-5 Days'
ELSEIF (DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])>=0
AND DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])<=3 )
then
'0-3 Days'
ELSE
'>10 DAYS'
END
Solved! Go to Solution.
Few ways to do this - could always just make a custom column finding the date difference and then grouping on the results, or make a column like this:
Could probably do it as a measure as well
IF(DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])>5
AND DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])<=10 )
then
'6-10 Days'
ELSEIF (DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])>=4
AND DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])<=5)
then
'4-5 Days'
ELSEIF (DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])>=0
AND DATEDIFF('day',[Min StartDate Per Payload],[Max EndDate per PayloadID])<=3 )
then
'0-3 Days'
ELSE
'>10 DAYS'
END
Few ways to do this - could always just make a custom column finding the date difference and then grouping on the results, or make a column like this:
Could probably do it as a measure as well
Hi there. The syntax in DAX should be like this
How it works "IF(Condition, TRUE, FALSE)"
IF(AND(Condition1, Condition2), "ResultTrue", IF(AND(Condition1, Condition2), "ResultTrue", IF( .... ) ) )
Check that the FALSE is your ELSEIF statement.
You can also do it on Power Query M. But it could be more complex the change due to Datediff function.
Regards,
Happy to help!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |