Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

IF Statement - Power BI Desktop

Hi everyone,

 

 

 I have a simple question and wantes some assitance. I have two columns (Reference Status and Date) in my dataset and wanted to create a simply IF statement. I want the IF statement to be "IF Reference Status = No, then display Date, otherwise display blank".

 

 Do I have to create a Custom Column for this IF Statement? Any help would be sincerely apprecated as I am new to Power BI.

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@Anonymous if you want to do this in Table View (after you've imported your Data) you use DAX like so

 

DAX => New Column = IF ( [Reference Status]="No", [Date], BLANK() )

 

if you want to do this during import in the Query Editor (just follow the picture)

Give the Column a Name and the conditions - the Query Editor will genetrate the column in M which is

M => if [Reference Status] = "No" then [Date] else ""

 

Conditional Column PQ.png

View solution in original post

5 REPLIES 5
Sean
Community Champion
Community Champion

@Anonymous if you want to do this in Table View (after you've imported your Data) you use DAX like so

 

DAX => New Column = IF ( [Reference Status]="No", [Date], BLANK() )

 

if you want to do this during import in the Query Editor (just follow the picture)

Give the Column a Name and the conditions - the Query Editor will genetrate the column in M which is

M => if [Reference Status] = "No" then [Date] else ""

 

Conditional Column PQ.png

Is there a way to create an IF statement based on the value of another table? For example, IF "Blah Table" = a value in "Blah Blah table" then return the value of "Compliant"...

 

Basically trying to have a column that says whether or not an application's version is "In Compliance"... but I want the unit, that is being measured, to be a separate table that is kept updated on its own.

 

Sorry if this makes no sense at all.... I will try my best to better explain myself if necessary.

 

I was able to get the IF statement working, if I manually entered the version, but I would like to get the version from another table, due to the fact that this is an application that has several modules that have to be kept updated on a regular basis.

 

If I can enter my values into a separate table and have that be my 'control' for the IF statement "true" portion, that would be amazing.

Hi,

 

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
msalam
Frequent Visitor

I'm receiving this error in my DAX query on calculated column as follows:

 

Column = IF(Reading[ServiceId]=1, Reading[Value] , "On")

 

ERROR:

Function 'IF' is not allowed as part of calculated column DAX expressions on DirectQuery models

 

Any Idea why i'm receiving that error?

Anonymous
Not applicable

Thank you for this..... Worked like a charm. Sincerely appricate it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors