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.
Hallo Everone,
I need help to transform the folowing situation into M query.
I hava the folowing situation, where I need to distinguish my DB in two stagges. where the condition of "Morning" , "Evening" and "night"changes over time.
data that are before 04.02.2018 then if time is between 10:00 and 12:00 then "Morning" and between 12:00 and 18:00 is "Evening" later is "Night" and the data after 04.02.2018 then if time is between 09:00 and 11:00 then "Morning" and between 11:00 and 17:00 is "Evening" later is "Night"
I want to do it directly in the Query so using M language , I am not looking for a measure.
@TatyDo , Try a new column in M-like. As I was not sure on month so, change as per need
if DateTime.Date([Date]) <#date(2018,02,04)
if DateTime.Time([Date]) >= #time(10,0,0) and DateTime.Time([Date]) >= #time(12,0,0) then "Morning" else
if DateTime.Time([Date]) >= #time(12,0,0) and DateTime.Time([Date]) >= #time(18,0,0) then "Evening" else "Night"
else
if DateTime.Time([Date]) >= #time(9,0,0) and DateTime.Time([Date]) >= #time(11,0,0) then "Morning" else
if DateTime.Time([Date]) >= #time(11,0,0) and DateTime.Time([Date]) >= #time(17,0,0) then "Evening" else "Night"
Thank you so much!, I needed to change some <> signs to fit and add then but it worked great 🙂
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 |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |