Forum Discussion
IF Statement - Power BI Desktop
- 10 years ago
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 ""
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 ""
- hodges9148 years agoRegular Visitor
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.
- Ashish_Mathur8 years agoSuper User
Hi,
Share some data and show the expected result.
- msalam9 years agoFrequent 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?
- Anonymous10 years agoNot applicable
Thank you for this..... Worked like a charm. Sincerely appricate it.