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

Поделиться
HTML-код
  • Опубликовано: 13 окт 2024

Комментарии • 150

  • @sankeshsankesh.sawang196
    @sankeshsankesh.sawang196 Год назад +3

    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 😀

  • @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 !

  • @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!

  • @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.

  • @kenmcmillan2637
    @kenmcmillan2637 Год назад

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

  • @shiffamohammed5818
    @shiffamohammed5818 Год назад

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

  • @rimkach
    @rimkach Месяц назад

    Quick and easy ! thanks for sharing your knowledge with us

  • @peterlewis2255
    @peterlewis2255 Год назад

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

  • @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!

  • @famoussuperstar2287
    @famoussuperstar2287 Год назад

    Thank you for explaining in very easy method, Thanks

  • @bucs2021
    @bucs2021 Год назад

    excellent, soothing... like all videos you make. Thanks

  • @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.

  • @alparkson5494
    @alparkson5494 Год назад

    Nice! So helpful. Thanks Mynda

  • @davidfamilydoctor9430
    @davidfamilydoctor9430 Год назад

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

  • @lopher70
    @lopher70 Год назад

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

  • @debashiss7410
    @debashiss7410 Год назад

    The learning never stops!

  • @MrDhunpagla
    @MrDhunpagla Год назад

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

  • @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.

  • @dbtech6548
    @dbtech6548 Год назад

    Useful information about function. Thank you so much 😊

  • @hadouken3xl
    @hadouken3xl Год назад

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

  • @llatyntseva
    @llatyntseva Месяц назад

    Thank you for the tutorial :)

  • @rajeshkhanna-ew6eb
    @rajeshkhanna-ew6eb 2 месяца назад

    Very well explained. 👍

  • @varko5083
    @varko5083 Год назад

    Just amazing person... 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.

  • @KarolLacko-b9l
    @KarolLacko-b9l 7 месяцев назад

    Very useful! Thank you

  • @DB-Au
    @DB-Au 3 месяца назад +1

    Better than Chat GPt and gemini, Queenslander!

  • @nazarkamal8831
    @nazarkamal8831 17 дней назад

    This is amazing ❤❤❤

  • @shrikantbadge3978
    @shrikantbadge3978 Год назад

    I am learning. Thank you.

  • @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

  • @willm7994
    @willm7994 7 месяцев назад

    Great video ❤

  • @gospelmoto2833
    @gospelmoto2833 Год назад

    Lovely!...as you are.

  • @mogarrett3045
    @mogarrett3045 Год назад

    great tutorial

  • @stephenclarke7351
    @stephenclarke7351 10 месяцев назад

    useful and to the point.

  • @shoppersdream
    @shoppersdream 5 месяцев назад

    Nice, thanks!

  • @satishgopal2406
    @satishgopal2406 7 месяцев назад

    Thank you Ma’am🙏😌

  • @jawadahmadehssan6251
    @jawadahmadehssan6251 Год назад

    Great content thank you.

  • @hiteshjal143
    @hiteshjal143 Месяц назад

    Thanks very Nice.

  • @firstninja2198
    @firstninja2198 5 дней назад

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

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  4 дня назад

      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.

  • @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

  • @Cahangir
    @Cahangir 11 месяцев назад

    Thanks

  • @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: ruclips.net/video/Eys3YTmtK2s/видео.html

  • @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

  • @melacesar2130
    @melacesar2130 4 месяца назад

    Thnx😍

  • @stanTrX
    @stanTrX 2 месяца назад

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

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  2 месяца назад

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

  • @prasadpatil8242
    @prasadpatil8242 Год назад

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

  • @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! ;)

  • @danishnawaz3651
    @danishnawaz3651 7 месяцев назад

    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

  • @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.

  • @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]

  • @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]]]

  • @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

  • @nazarkamal8831
    @nazarkamal8831 17 дней назад

    ❤❤❤

  • @danishnawaz3651
    @danishnawaz3651 8 месяцев назад

    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  8 месяцев назад

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

  • @mohammadsoori9712
    @mohammadsoori9712 Год назад

    great

  • @kumaryadav4256
    @kumaryadav4256 Год назад

    is there a way to avoid overwriting rule?

  • @IamTheReaper911
    @IamTheReaper911 Год назад

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

  • @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

  • @povsok8939
    @povsok8939 Месяц назад

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

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Месяц назад

      Please post your question and sample Excel file on our forum where someone 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?

  • @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.

  • @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.

  • @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.

  • @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%!

  • @erikv2382
    @erikv2382 2 месяца назад

    "null" causes errors for me

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  2 месяца назад

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

  • @vikashdwivedi2902
    @vikashdwivedi2902 6 месяцев назад

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

    • @vikashdwivedi2902
      @vikashdwivedi2902 6 месяцев назад

      How to right in power query can you please guide

  • @Carlitos117
    @Carlitos117 Год назад

    Marry me! 😍🤩🥹