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.
I have a time column and want to create a column for 3 shifts:
Morning -> between 07:31:00 AM and 15:30:00 PM
Afternoon -> between 15:31:00 PM and 23:30:00 PM
Night -> between 23:31:00 PM and 07:30:00 AM
I made de following DAX code for a shifts column:
Can somebody explain why i am getting blank ?
Thank you in advance.
Solved! Go to Solution.
@Anonymous , Try like
shifts =
SWITCH(
TRUE(),
TIMEVALUE('Tabel'[Time]) >= TIME(23,30,0),"Night",
TIMEVALUE('Tabel'[Time]) >= TIME(15,30,0), "Afternoon",
TIMEVALUE('Tabel'[Time]) >= TIME(7,30,0), "Morning"
TIMEVALUE('Tabel'[Time]) < TIME(7,30,0), "Night"
)
Why don't you check it by yourself?
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@Anonymous , Try like
shifts =
SWITCH(
TRUE(),
TIMEVALUE('Tabel'[Time]) >= TIME(23,30,0),"Night",
TIMEVALUE('Tabel'[Time]) >= TIME(15,30,0), "Afternoon",
TIMEVALUE('Tabel'[Time]) >= TIME(7,30,0), "Morning"
TIMEVALUE('Tabel'[Time]) < TIME(7,30,0), "Night"
)
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 |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |