How to write a Multiple (nested) IF in Power Query

How to write a Multiple (nested) IF in Power Query

Access Analytic

1 год назад

15,317 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@chrism9037
@chrism9037 - 30.04.2023 13:10

Awesome video, thanks Wyn

Ответить
@jppinto4926
@jppinto4926 - 26.01.2024 01:17

Thanks for the videos. Very helpful. Being pedantic though, in aussie slang:
avo = avocado;
arvo = afternoon.

Ответить
@jackleong5212
@jackleong5212 - 13.08.2023 15:12

WOW! Thanks for sharing!
This is really goood when dealing with multiple segmentations, sub-segmentations, and categorization😍
Nested IF might become really complicated when if the source was empty and so on...
With tables like the 2nd one is much easier to understand and benefit for both creator and user

Ответить
@mattmatt245
@mattmatt245 - 06.08.2023 18:09

That'll break query folding. I still need to write sql :(

Ответить
@HandyPaladin
@HandyPaladin - 11.07.2023 00:58

Less a question about this video than a suggestion for another one.

One thing I find frustrating when using Power Query is it refreshing the data each time I add a new step.

For example, I have a query that appends all of the service snapshots in a folder, extracts one column (Service Id), removes duplicates, sorts accending, and outputs to a table.

I want to add some cleaning steps because some of the Ids have suffixes that I don't need, but every time I add a step the query seems to import the base data again.

Is there any way to change that behaviour?

Ответить
@nevenmesic2856
@nevenmesic2856 - 06.07.2023 17:33

Can i for example say if something in column is null then return value from different column else give me value from original column? Tried to combine columns but values are numbers not text...

Ответить
@Andy-fd5fg
@Andy-fd5fg - 01.07.2023 14:29

oooo parameters and sub-routines.... more of them please

Ответить
@abdulsaidmkamara7305
@abdulsaidmkamara7305 - 14.05.2023 13:39

I love the append method , writing M language still scares me 😅😅😅

Ответить
@Donkeys_Dad_Adam
@Donkeys_Dad_Adam - 08.05.2023 23:12

Excellent as always Sir!

Ответить
@sanchowitfurrows1561
@sanchowitfurrows1561 - 07.05.2023 21:52

Let's imagine Karen's "Time Started"=3:00PM and Afternoon Shift "Time Started" = 3:00PM.
What can ensure us that Sorting will put Shifts row above Timesheet row?

Ответить
@sanchowitfurrows1561
@sanchowitfurrows1561 - 07.05.2023 21:48

Wyn, you literally saved me hours of waiting time!
My initial approach was
1) to have Shifts table with "Start Shift" and "End Shift" columns,
2) then Merge Shifts table to the Timetable,
3) then expand Shifts with replicating timetable rows,
4) adding calculated column to check that Timetable[Start Time] fits between Shifts[Start Time] and Shifts[End Time]
5) filtering out false rows

You can imagine computational complexity when I have 800K rows in Timetable and 12 rows in Shifts!
I'm feeling shivers of excitement to try it tomorrow!

Ответить
@mirrrvelll5164
@mirrrvelll5164 - 06.05.2023 23:13

I was today years old with that IF method from you...never knew that LET-IN can be used as Custom Column :O

Ответить
@tracylippiatt3238
@tracylippiatt3238 - 02.05.2023 11:58

I love the Fill Down - what a simple solution

Ответить
@viktorasgolubevas2386
@viktorasgolubevas2386 - 01.05.2023 20:14

Thanks for sharing!
ugly but minute workaround if we leave [Time Started] as Decimal and use Conditional Column for if-else skeleton :)

let
Source = Excel.CurrentWorkbook(){[Name="tblShifts"]}[Content],
#"Added Conditional Column" = Table.AddColumn(Source, "Shift", each
if [Time Started]*24 < 6 then "Night"
else if [Time Started]*24 < 15 then "Morning"
else if [Time Started]*24 < 23 then "Afternoon"
else "Night")
in
#"Added Conditional Column"

Ответить
@alinelviscitalungu4132
@alinelviscitalungu4132 - 01.05.2023 17:16

Great information!! Thanks !!
How can i change formula if during the weekend i work in 2 shifts and in Workday i have 3 shifts?
Thank you!!!

Ответить
@ianrhile
@ianrhile - 01.05.2023 13:48

I love the second method! Thanks, Wyn.

Ответить
@FRANKWHITE1996
@FRANKWHITE1996 - 01.05.2023 11:13

Awesome ❤

Ответить
@SuperJorgeRegula
@SuperJorgeRegula - 30.04.2023 19:27

Thanks. What is the benefit of doing it in PowerQuery as opposed adding a calculated column with DAX using switch true?

Ответить
@Dan_De_Man
@Dan_De_Man - 30.04.2023 15:14

Wouldnt let me enter let in custom column. I enterd let then enter and it changes to = Lines ToText

Ответить
@justrelaxmusic5131
@justrelaxmusic5131 - 30.04.2023 14:45

Awesome Wyn. Love your videos. Thanks for the wonderful stuff.

Ответить
@Bhavik_Khatri
@Bhavik_Khatri - 30.04.2023 10:04

Thank you for the great video

Ответить
@chiragdabhi4929
@chiragdabhi4929 - 30.04.2023 07:50

I want simple if formula for coloum where value less than 100. I want if formula for that value..if <98 then 1 if < 95 then 2 else 3..pls help

Ответить
@chiragdabhi4929
@chiragdabhi4929 - 30.04.2023 07:47

Good.

Ответить