How to Write Power Query if Statements incl. Nested ifs, if or, if and with the IF function

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ธ.ค. 2024

ความคิดเห็น • 154

  • @sankeshsankesh.sawang196
    @sankeshsankesh.sawang196 ปีที่แล้ว +5

    The easiest way to learn Excel and power bi from online platform That is you...👌

  • @Seftehandle
    @Seftehandle ปีที่แล้ว +4

    This is what i needed to get into dax or M. Simple way to get me the basics! Great job Mynda 🎉🎉🎉🎉🎉

  • @sjdyt
    @sjdyt ปีที่แล้ว +3

    I’m really embracing PQ in my new job.
    Since learning the basics (mostly from you thank you) this is the first time I’ve used it for real work tasks. I have already dabbled with nested ifs etc. and they are so simple and logical now I’ve done it a few times.
    Loads more opportunities for me to clean things up and make processes more efficient using PQ 😀

  • @jackcurl2005
    @jackcurl2005 ปีที่แล้ว +1

    Having a more expressive mechanism (if/then/else vs if/,/,/) makes what you're doing so much more obvious and easier to fix when/if necessary. Microsoft has historically been less-than-helpful in the code-formatting arena (worst example: Access SQL), so preserving whatever formatting you have used is super helpful. Thanks for a nicely-done video!

  • @thiruvallurusrikala5980
    @thiruvallurusrikala5980 ปีที่แล้ว

    I was taking my baby steps in Power BI and this nested if then, solved my requirement. Thank you for a detailed explanation.

  • @chrism9037
    @chrism9037 ปีที่แล้ว +1

    Very clearly explained, thanks Mynda !

  • @debashiss7410
    @debashiss7410 ปีที่แล้ว

    The learning never stops!

  • @mohamedtalaat5836
    @mohamedtalaat5836 ปีที่แล้ว +1

    Awesome as usual, thanks. I want to ask when microsoft Copilot will be available in Excel?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว +2

      Thank you! Copilot should be available soon. I don't have it yet, and we MVPs haven't been given an ETA.

  • @kenmcmillan2637
    @kenmcmillan2637 ปีที่แล้ว

    Great video! You are right, If/And/Or are much easier to write that Excel. Thank you so much for excellent tutorials.

  • @aynellrodriguez7348
    @aynellrodriguez7348 ปีที่แล้ว

    This was excellent and couldn't be more clearly explained, thank you very much for creatings these videos!

  • @michaelp9061
    @michaelp9061 ปีที่แล้ว

    Thank you so much for this step-by-step tutorial.

  • @peterlewis2255
    @peterlewis2255 ปีที่แล้ว

    Thank you so much Mynda, filled a glaring gap in my PQ skills

  • @shiffamohammed5818
    @shiffamohammed5818 ปีที่แล้ว

    Thank you so much for the informative power query tutorial video, Mynda.

  • @loriwhittaker4577
    @loriwhittaker4577 ปีที่แล้ว

    Hello. I just wanted to say Hi and thank you!! You are an amazing instructor! I have learned so much from you and I cannot wait to learn more! You break down everything very thoroughly to where it is understood. Thank you for your videos!

  • @lopher70
    @lopher70 ปีที่แล้ว

    you did it again, this open a window of opportunities to improve my process!!

  • @rimkach
    @rimkach 3 หลายเดือนก่อน

    Quick and easy ! thanks for sharing your knowledge with us

  • @famoussuperstar2287
    @famoussuperstar2287 ปีที่แล้ว

    Thank you for explaining in very easy method, Thanks

  • @alparkson5494
    @alparkson5494 ปีที่แล้ว

    Nice! So helpful. Thanks Mynda

  • @craigsmall7984
    @craigsmall7984 ปีที่แล้ว +1

    I love Power Query (Phil told me it would change my life, and he was right), but it has an annoying quirk when it comes to the "if". If I write a "simple if", Power Query will take it upon itself to convert it to a conditional column. This is all very well, unless I was to go back and use a slightly more complex test - the dialogue box is no longer exposed! I know, First World problems ...
    Can I suggest that you consider using indenting and multiple lines for your if statements? I feel that it's a good practice, and in my experience can make the statement easier to read. Just a thought.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว +1

      Yes, I agree that is annoying, but you can always modify it in the formula bar, which is what I usually do. Indenting is a good idea, but I'm so used to writing formulas in Excel without it, that it's easy to do it that way. That said, if I'm writing a complex nested formula, then I sometimes will indent it to make it easier down the track.

  • @Quidisi
    @Quidisi ปีที่แล้ว +2

    Totally agree that conditional functions in PQ are easier than Excel. PQ in also more helpful in finding errors, too.

  • @davidfamilydoctor9430
    @davidfamilydoctor9430 ปีที่แล้ว

    Thanks for confirming 'null' means blank. Struggled with this recently and figured it out, but nice to know for sure.

  • @llatyntseva
    @llatyntseva 3 หลายเดือนก่อน

    Thank you for the tutorial :)

  • @rajeshkhanna-ew6eb
    @rajeshkhanna-ew6eb 4 หลายเดือนก่อน

    Very well explained. 👍

  • @Dravidan1971
    @Dravidan1971 24 วันที่ผ่านมา +1

    Please make a video for beginners for errors while drafting dax formulas, like syntax error, missing parenthesis or unexpected expression or any other technical word errors please.

  • @dbtech6548
    @dbtech6548 ปีที่แล้ว

    Useful information about function. Thank you so much 😊

  • @hadouken3xl
    @hadouken3xl ปีที่แล้ว

    Thank you very much!! this is exactly what I was looking for. 🥰

  • @DB-Au
    @DB-Au 6 หลายเดือนก่อน +1

    Better than Chat GPt and gemini, Queenslander!

  • @shrikantbadge3978
    @shrikantbadge3978 ปีที่แล้ว

    I am learning. Thank you.

  • @宋萌-b3u
    @宋萌-b3u ปีที่แล้ว

    Thank you so much. Very useful.

  • @stevebulls7744
    @stevebulls7744 ปีที่แล้ว

    It's a shame that Excel itself doesn't support IF/THEN/ELSE statements. It would be much easier to write formulas! As always, Thank you, Mynda, for this interesting nugget!! I always enjoy the info you have to share and look forward to your videos. Take care.

  • @MrDhunpagla
    @MrDhunpagla ปีที่แล้ว

    Thank you ☺️ again for this super informative tips...need more on PQ if possible. Visuals & animations are awesome 👍

  • @KarolLacko-b9l
    @KarolLacko-b9l 9 หลายเดือนก่อน

    Very useful! Thank you

  • @nazarkamal8831
    @nazarkamal8831 2 หลายเดือนก่อน

    This is amazing ❤❤❤

  • @willm7994
    @willm7994 9 หลายเดือนก่อน

    Great video ❤

  • @mogarrett3045
    @mogarrett3045 ปีที่แล้ว

    great tutorial

  • @varko5083
    @varko5083 ปีที่แล้ว

    Just amazing person... thank you

  • @satishgopal2406
    @satishgopal2406 9 หลายเดือนก่อน

    Thank you Ma’am🙏😌

  • @firstninja2198
    @firstninja2198 2 หลายเดือนก่อน

    Great Video. How can I scrap of the url does not have a page
    start number?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  2 หลายเดือนก่อน

      The URL doesn't have to have a page number as such, it just needs a different URL for each page of data that uses a pattern to the URL that you can predict. If you're able to change the view of the data on the page, but the URL doesn't change, then Power Query can't scrap the data.

  • @jawadahmadehssan6251
    @jawadahmadehssan6251 ปีที่แล้ว

    Great content thank you.

  • @JaniceCook-jx8pw
    @JaniceCook-jx8pw ปีที่แล้ว

    Really useful thanks.
    How can I refer to other cells in the statement.
    In your example, the 5 and 10% would ideally be held in cells that you can refer to in the if so that if they change the %age you don’t need to change the formula.
    I also have an example where if a condition is true I want to take a value from the row above… how do I refer to that?
    Many thanks!!

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      There are a few ways you can do this in PQ, e.g. variables, separate tables/queries etc. as explained here: www.myonlinetraininghub.com/power-query-variables-3-ways
      Referencing rows above is covered here: www.myonlinetraininghub.com/referencing-next-row-power-query

  • @shoppersdream
    @shoppersdream 7 หลายเดือนก่อน

    Nice, thanks!

  • @gospelmoto2833
    @gospelmoto2833 ปีที่แล้ว

    Lovely!...as you are.

  • @stephenclarke7351
    @stephenclarke7351 ปีที่แล้ว

    useful and to the point.

  • @mattmatt245
    @mattmatt245 ปีที่แล้ว

    Would it be possible to create custom type of join in PQ ? Say, that you want to merge all records from one table with their overlapping records from the second table (start date/end date). Is it possible ?
    Thank you
    Matt

  • @stanTrX
    @stanTrX 4 หลายเดือนก่อน

    thanks, what about referring a formula for the next row? how can we do that?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  4 หลายเดือนก่อน

      There are a few ways we can do this as explained here: www.myonlinetraininghub.com/referencing-next-row-power-query

  • @hiteshjal143
    @hiteshjal143 3 หลายเดือนก่อน

    Thanks very Nice.

  • @fbjrivers3354
    @fbjrivers3354 ปีที่แล้ว

    The video is wonderful and almost gives me what I need. I have a data table where each person can have phone number in 4 separate columns. I want to add a column that give a total how many numbers they have. I can get the answer of 1, but not 2 or 3 or 4.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      Thank you! You can use List.NonNullCount e.g. if your phone numbers are in columns named No1 through No4:
      = List.NonNullCount({[No1], [No2], [No3], [No4]})
      If you get stuck, post your question and sample Excel file on our forum where someone can help you further: www.myonlinetraininghub.com/excel-forum

  • @hazemali382
    @hazemali382 9 วันที่ผ่านมา

    more than greet Mynda ♥

  • @sajilprkkv
    @sajilprkkv ปีที่แล้ว

    How to activate to show all available formulas while we start writing the formula in power query? Anyone knows ? 2:55

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      This is available in later versions of Excel. If you don't see the function list appear, it's because your version of Excel doesn't have this feature. You'd have to upgrade to get it.

    • @sajilprkkv
      @sajilprkkv ปีที่แล้ว

      @@MyOnlineTrainingHub thank you for the reply, I have office 2019, do I need to turn on any options to get or this version don’t have it?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      I can't remember what version is came in, but it's not something you turn on/off. It's either there or it isn't. The best you can do is update your installation of 2019 and see if you get it in an update, but remember that perpetual licenses like 2019 do not usually get updates for new features, only bug fixes.

  • @dhaniatami3718
    @dhaniatami3718 ปีที่แล้ว

    hi! i have a data master connect with the query. it is possible:
    - to make a formula when i input a new data master a number but when i refresh the query it become a text?
    - when i input " - " in data master it become delete rows in query? so when there is " - " in data master, the query doesn't insert it into the table

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      Not sure I follow what you mean. Please post your question and sample Excel file on our forum where we can help you further: www.myonlinetraininghub.com/excel-forum

  • @RussellJones-k9p
    @RussellJones-k9p ปีที่แล้ว

    What do you put for else if you want no change to the data if the condition is false? I have a column of numbers and I want to change the zeroes and negative numbers to null but want the positive numbers to stay as they are. My next step will be to filter out the nulls.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      In that case the else will be the column you're checking. e.g. if [column1]

  • @astrokier
    @astrokier ปีที่แล้ว

    Please consider a video of creating an unbreakable form for everyone to enter data, so that it can be translated in PowerBI dashboard 😊

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      Have you tried Excel Forms: th-cam.com/video/Eys3YTmtK2s/w-d-xo.html

  • @prasadpatil8242
    @prasadpatil8242 ปีที่แล้ว

    Hi ,Can you take session on how to convert Descriptive data into tables through Power Query or other Excel tools

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      'Descriptive data', do you mean descriptive statistics?

  • @Skip2MiLuu
    @Skip2MiLuu ปีที่แล้ว +1

    Can you show how do sumifs in a follow up video

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      Good idea. In the meantime I have this tutorial: www.myonlinetraininghub.com/excel-sumif-and-sumifs-formulas-explained

    • @Skip2MiLuu
      @Skip2MiLuu ปีที่แล้ว

      Thanks for the reply and link, but I am quite familiar with excel SUMIFS.
      I am however trying to figure out how to convert the below SUMIFS function to one I can copy into a Power Query Custom Column that will calculate on each row.
      SUMIFS Excel:
      -Sum_range: Country_Variety_Sales[2023 TOTAL]
      -Criteria_range 1: Country_Variety_Sales[Secondary No]
      -Criteria1: Country_Variety_Sales[@[Secondary No]]
      -Criteria_range 2: Country_Variety_Sales[Country]
      -Criteria2: Country_Variety_Sales[@[Country]]]

  • @Cahangir
    @Cahangir ปีที่แล้ว

    Thanks

  • @mohang5925
    @mohang5925 หลายเดือนก่อน

    What if we have different data in two different columns how to analyse can you pls help with that

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  หลายเดือนก่อน

      Not sure how your data is structured. Probably best if you post your question and sample Excel file on our forum where someone can help you further: www.myonlinetraininghub.com/excel-forum

  • @melacesar2130
    @melacesar2130 6 หลายเดือนก่อน

    Thnx😍

  • @kumaryadav4256
    @kumaryadav4256 ปีที่แล้ว

    is there a way to avoid overwriting rule?

  • @Kimwenman
    @Kimwenman ปีที่แล้ว

    This was a great video and so easy to follow. I have an issue with my nested IF statements in Power Query when referring to dates. I have a column with a date and a column with a Stage. My formula is:if[Start Ship Date] = "3/1/2024" and [Stage] = "stage 3" then "green" else
    if [Start Ship Date]= "3/1/2024" and [Stage] = "stage 2" then "green" else
    if [Start Ship Date] = "3/1/2024" and [Stage] = "stage 1"
    then "red" else
    if [Start Ship Date] = "9/1/2024" and [Stage] = "stage 0" then "red" else
    if [Start Ship Date] = "9/1/2024" and [Stage] = "stage 1" then "green" else
    if [Start Ship Date] = "9/1/2024" and [Stage] = "stage 2" then "green" else
    if [Start Ship Date] = "9/1/2024" and [Stage] = "stage 3" then "green"
    else "yellow"
    The issue is all the results are turning out to be YELLOW - when I know the if [Start Ship Date] = "9/1/2024" and [Stage] = "stage 2" then "green" else - I should be getting green. What am I missing? Do I need to choose a different way to have my date = ? I am confused.....hoping you can help. Thanks!!

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      Thank you! Your formula is probably looking for something that's not there, hence the last else "yellow" being returned. It could be that the data is written 'Stage 1" etc. rather than "stage 1". Power Query is case sensitive, so these are not the same. It could be that in the column called 'Stage' and the actual data is only the number, not prefixed by 'stage'. If it's not that, then please post your question and sample Excel file on our forum where we can help you further: www.myonlinetraininghub.com/excel-forum

    • @Kimwenman
      @Kimwenman ปีที่แล้ว +1

      @@MyOnlineTrainingHub thank you - I realized that the formula to equal date needed to read:
      [Start Ship Date] =#date(2024,9,1) I updated all those instances and it worked! ;)

  • @claudiobarbosa4702
    @claudiobarbosa4702 ปีที่แล้ว

    Como faço para utilizar a formula SE e E no power query envolvendo horas?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      Not sure what you mean by SE and E. Please post your question and sample Excel file on our forum where we can help you further: www.myonlinetraininghub.com/excel-forum

  • @lmbob703
    @lmbob703 ปีที่แล้ว

    How would you write an if statement to identify a specific word in a cell?

  • @reng7777
    @reng7777 ปีที่แล้ว +1

    Hi amiga! thanks for your video..i have a comments/ questions for you... i have implemented some small solutions with Power Query but sometimes i found that it is better to write the code in the Advance Editor in order to make it more efficient ( for some scenarios the function is not in the menu option in the Power Query window).. ..I see that nobody provides an speciization tranining on M LANGUAGUE CODE, when this is a key tool that allows us to set a better performance and provide faster solutions.. so my question to you is have you considering on providing an ON DAMAND full course just focus on M LANGUAGUE with real life examples? if you take the time to considere it, do not hesitate that i will be paying for your course!!! actually whay if you can collect some problems that in our day to work we face( it will be obvious that the figures will not be from our company )and then with that information you can set the course( OBVIOUSLY NOT FOR FREE) .

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว +1

      Thanks for the suggestion! M is a vast topic indeed and I do cover some of it in my Power Query course: www.myonlinetraininghub.com/excel-power-query-course you can see the topics at the above link under the syllabus section.

  • @povsok8939
    @povsok8939 3 หลายเดือนก่อน

    How to use if statement for reciprocal count based on the date?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  3 หลายเดือนก่อน

      Please post your question and sample Excel file on our forum where someone can help you further: www.myonlinetraininghub.com/excel-forum

  • @danishnawaz3651
    @danishnawaz3651 10 หลายเดือนก่อน

    plz make video for below.
    If
    1 table has 9 column,
    2 table has 10
    and 3 table has 8 .
    Then how can we make equal all column for all table.. like we want to insert dummy column for missing column in tables and make equal like 10 column for each table.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  10 หลายเดือนก่อน

      If you append tables 1 and 3 to table 2, the data will be in a 10 column table.

  • @danishnawaz3651
    @danishnawaz3651 10 หลายเดือนก่อน

    Plz make Video for below Formula "Power Query", Video Time Fram is Max 10mint
    1. List.RemoveMatchingItems
    2. List.ReplaceMatchingItems
    3. List.TransformMany
    4. List.ReplaceValue
    5. List.PositionOfAny
    6. List.PositionOf
    7. List.NonNullCount
    8. List.Intersect
    9. List.Durations
    10. List.Difference
    11. List.FindText
    12. List.InsertRange
    13. List.Union

  • @mohammadsoori9712
    @mohammadsoori9712 ปีที่แล้ว

    great

  • @nazarkamal8831
    @nazarkamal8831 2 หลายเดือนก่อน

    ❤❤❤

  • @IamTheReaper911
    @IamTheReaper911 ปีที่แล้ว

    IF this ......
    🤪😜
    👍😎

  • @tamma369
    @tamma369 ปีที่แล้ว

    null doesn't work for me only ""

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว +1

      That'll be because those cells aren't properly blank. Blanks returned by formulas that specify a blank with two double quotes are not 'blank' in the true sense. Hope that clarifies why you're having to use "".

  • @Acheiropoietos
    @Acheiropoietos ปีที่แล้ว +2

    Managers should get 5%! Workers 10%!

  • @ssmith8717
    @ssmith8717 ปีที่แล้ว

    “” is not working properly with formulas in my dimension table.
    =if[PL]="Z0" and [#"$ Decrease"]="" then
    [Z0 FABRIC] else 0
    The code is returning 0 but the data in [Z0 Fabric] is the desired return.
    2nd question:
    How can I properly calculate Roundup located in the dimension table? The dimension table holds the percentage and dollar increases along with the roundup to the dollar specified. The Then part of the code below should calculate as follows:
    [Z0 Fabric] which is a price * [#"% Increase"]} which is a percentage and [Roundup] to the value located in the dimension table.
    if [PL]="Z0" and [#"$ Increase"]""and [Roundup $] ”” then {[Z0 FABRIC]*[#"% Increase"]}*[Roundup] else [Z0 FABRIC]

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว

      There are a few odd things in your formulas because you're referencing steps and columns in the same IF:
      =if[PL]="Z0" and [#"$ Decrease"]="" then [Z0 FABRIC] else 0
      You could try:
      =if [PL]="Z0" and [$ Decrease]="" then [Z0 FABRIC] else 0
      And this one has curly braces, which aren't required:
      if [PL]="Z0" and [#"$ Increase"]""and [Roundup $] ”” then {[Z0 FABRIC]*[#"% Increase"]}*[Roundup] else [Z0 FABRIC]
      I think it's best if you post your question and sample Excel file on our forum where we can help you further: www.myonlinetraininghub.com/excel-forum

    • @ssmith8717
      @ssmith8717 ปีที่แล้ว +1

      Thank you! I appreciate your quick response and suggestion.

  • @erikv2382
    @erikv2382 4 หลายเดือนก่อน

    "null" causes errors for me

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  4 หลายเดือนก่อน

      null it doesn't go inside double quotes in the formula. I wonder if that's what you're doing.

  • @DavidKing-wk1ws
    @DavidKing-wk1ws ปีที่แล้ว

    Have been looking for the right specs for excel. No one has an answer. Of you fill every cell in a spreadsheet and fill every spreadsheet that can be in a workbook. How much ram/cpu would you need for it to run without taking a month to calculate?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  ปีที่แล้ว +1

      Probably because if you have that much data that you fill every cell in every sheet, then you should be using something else, otherwise you'd probably need a super-computer. If it helps, I have a 3.7GHz CPU with 32GB RAM and a solid state drive. My PC is lightning fast and Excel never has a problem coping with the work I do, but I'm by no means filling every cell in every sheet.

    • @DavidKing-wk1ws
      @DavidKing-wk1ws ปีที่แล้ว +1

      @@MyOnlineTrainingHub Thank you for your response. It seems memory is key here so I will go with the odroid h3+ as it allows for 64 gb ram and a 2 ghz cpu with 3.3 burst or sustained high speed. Will find out if this fits the bill. Thank you.

  • @vikashdwivedi2902
    @vikashdwivedi2902 8 หลายเดือนก่อน

    IF(J2="NEUBUS3AXXX",K2,LEFT(K2,4)&"/"&IF(D2=202,RIGHT(12,10),IF(D2=210,RIGHT(H2,10)))))))

    • @vikashdwivedi2902
      @vikashdwivedi2902 8 หลายเดือนก่อน

      How to right in power query can you please guide

  • @Carlitos117
    @Carlitos117 ปีที่แล้ว

    Marry me! 😍🤩🥹