cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PradipMCT Regular Visitor
Regular Visitor

Write IF function with in Table Rows

Hi Friends,

 

Thanks for your help. 

 

I am working on a table as shown in the screenshot. I want to write IF function in the table rows. So far i have written the functions like, Table.Skip, Table.FillDown, Table.PromoteHeaders etc. I am unable to figure out how to write IF function in Power Query. 

 

Kindly help me if i have to write a funciton, if value is greater than a certain number then it should return true else false. 

 

Regards,

PradipPower Query function.png

7 REPLIES 7
Nathaniel_C Super Contributor
Super Contributor

Re: Write IF function with in Table Rows

Hi @PradipMCT ,

 

Please see picture below. To add an if column, go to Add Column, select Condition Column, and fill in the boxes.  You may add additional if statements.  If you look at the function bar after you have done this, you will see the M language terminology for this.

 

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

 

IF in pq.PNG

PradipMCT Regular Visitor
Regular Visitor

Re: Write IF function with in Table Rows

Hi @Nathaniel_C 

 

Thanks a ton for responding. 

 

I know this way to write IF Function. My question was how to write IF function in the Row Table as shown/highlighted below in the screenshot. In those Row Tables, I would like to write IF function that is applicable to all the rows not just the current table. These tables are hidden inside the row. Hope i could make it simpler to understand!

 

Pradip Pardeshi

Microsoft Certified Trainer

Pradip's Youtube Channel

Power Query function.png

Nathaniel_C Super Contributor
Super Contributor

Re: Write IF function with in Table Rows

Hi @PradipMCT ,

I have heard that @ImkeF is the one to go to for M language questions!

Nathaniel

PradipMCT Regular Visitor
Regular Visitor

Re: Write IF function with in Table Rows

Hi @Nathaniel_C 

 

Thanks for tagging him to the post. Appreciate it.

 

@ImkeF Can you please help me with my query?

 

Pradip Pardeshi

Microsoft Certified Trainer

Pradip's Youtube Channel

Super User
Super User

Re: Write IF function with in Table Rows

Not sure about your request: What shall the if-statement do? Do you want to use it in a Table.AddColumn-comand on those nested tables?

 

If you liked my solution, please give it a thumbs up. An if I did answer your question, please mark my post as a solution. Thanks!

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




PradipMCT Regular Visitor
Regular Visitor

Re: Write IF function with in Table Rows

Hi, @ImkeF  Thanks for responding. I have a column in which a word total is written. I would like to remove only the rows that contain the total row. I thought I can use the logic, i.e. if the cell contains the word "TOTAL" I will filter them out using an additional column and use IF in it. Otherwise, also I would like to know if we can write IF Function in such situation. Regards, Pradip Pardeshi

Pradip's Youtube Channel

gpoggi Regular Visitor
Regular Visitor

Re: Write IF function with in Table Rows

Hi @PradidMCP,

Uhmm I’m not in my laptop right now, but what if you expand that Filldown column, once expanded filter or replace using M code the desired column and once you finish and get what you need, select first columns (from year to Custom) go to transform, Group By and select All Rows as Operation and check if you get what you need.

Let me know if this helps.


Regards,

Gian Carlo Poggi

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)