- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

IF and Statement in Excel Power Query
I am trying to create below scenario in excel power query, where I'm getting when trying to create Point. 2 & 3
table as below
Type | Amount_A | Amount_B | Amount_C |
New | 8921 | ||
Renew | 3703 | ||
Renew | 427 | ||
Renew | 7379 | ||
Renew | 3148 | ||
Renew | 787 | ||
New | 2437 | ||
New | 6799 | ||
1544 | 0 | ||
7912 | 0 | ||
9610 | 0 | ||
New | 2513 | ||
New | 7962 | ||
Renew | 4483 | ||
Renew | 1296 | ||
Renew | 4438 | ||
Renew | 3202 | ||
0 | 7922 | ||
0 | 1413 | ||
0 | 4167 | ||
0 | 5959 | ||
0 | 6227 | ||
New | 843 | ||
New | 6560 | ||
New | 7359 | ||
Renew | 5718 | ||
0 | 0 | ||
0 | 0 | ||
1097 | 1682 | ||
5991 | 133 | ||
New | 3569 | ||
New | 3899 | ||
New | 4583 | ||
New | 7713 | ||
New | 2874 | ||
New | 2938 |
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

in the example data you gave the Amount_A values were null.
Changed the code so it works with = 0 too 🙂
if [Amount_A] = null or [Amount_A] = 0 then
if [Amount_C] = null or [Amount_C] = 0 then
if [Amount_B] = 0 or [Amount_B] = null
then null
else "Expiring"
else "Renewed"
else [Type]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I think this should do the trick. Add a new custom column with the following code:
if [Amount_A] = null then
if [Amount_C] = null or [Amount_C] = 0 then
if [Amount_B] = 0 or [Amount_B] = null
then null
else "Expiring"
else "Renewed"
else [Type]
Tip: Basing logic on the False premise (C <> 0) often makes things more complicated. Try to build your logical from the true (C = 0) premise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

You will have to add another custome column in Powerqueryas following,
= if [Type] <> null and [Type] <> "" then [Type]
else if [Amount C] <> 0 or [Amount C] <> null then "Renewed"
else if ([Amount B] = 0 or [Amount B] = null) and ([Amount C] = 0 or [Amount C] = null) then ""
else "Expiring"
Please accept it as solution if works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

this is the result of both solutions .. expring is missing in both
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

in the example data you gave the Amount_A values were null.
Changed the code so it works with = 0 too 🙂
if [Amount_A] = null or [Amount_A] = 0 then
if [Amount_C] = null or [Amount_C] = 0 then
if [Amount_B] = 0 or [Amount_B] = null
then null
else "Expiring"
else "Renewed"
else [Type]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

my bad .. I changed it to 0 in last moment while uploading to make it more simple which missed your first line of code.. thank you so much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Glad I could help!

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
09-29-2021 11:53 PM | |||
Anonymous
| 11-11-2022 02:18 AM | ||
06-26-2024 04:46 AM | |||
09-12-2024 04:19 AM | |||
05-21-2024 03:36 AM |
User | Count |
---|---|
26 | |
25 | |
24 | |
13 | |
10 |
User | Count |
---|---|
24 | |
21 | |
18 | |
17 | |
10 |