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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

DAX to Filter dates using specific Category and then apply if condition

Hi, 

 

I need help, I am not sure if I am even trying which make sense or not. 

 

AH1988_0-1637082253034.png

I have the above table. I want to filter "Task 2" from the "Task Name" column and then check if "Finish" is > "BL Finish" then print "Behind" else  "Target" . 

 

Any help would be appreciated. 

 

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on  your description, the issue would not appear when you create a new pbix file?

And it works fine on my side as well. so this seems like a transient issue should go away. 

Eyelyn9_0-1637631893805.png

 

Make sure your PBI is always the latest version.

And actually when you create a calculated column,prefix of table name is not necessary, so you could simply use the following formula:

Column = IF([Task Name]="Task2" ,IF( [Finish]>[BL FInish],"Behind","Target"))

Eyelyn9_1-1637632303543.png

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on  your description, the issue would not appear when you create a new pbix file?

And it works fine on my side as well. so this seems like a transient issue should go away. 

Eyelyn9_0-1637631893805.png

 

Make sure your PBI is always the latest version.

And actually when you create a calculated column,prefix of table name is not necessary, so you could simply use the following formula:

Column = IF([Task Name]="Task2" ,IF( [Finish]>[BL FInish],"Behind","Target"))

Eyelyn9_1-1637632303543.png

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mattww
Responsive Resident
Responsive Resident

Hi @Anonymous ,

 

If I'm understanding your rule correctly, would a Calculated Column like this work?

 

TargetStatus = IF('Table'[Task Name] = "Task2",IF('Table'[Finish] > 'Table'[BL Finish],"Behind","Target"),BLANK())

The same could be achieved in Power Query, different syntax, so let me know if that's preferable

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Anonymous
Not applicable

Not sure what's happening. I have closed the current file PBIX and opened the new PBIX. It worked. Unbelievable I spent hours using different combinations of DAX and looks like some different problem... not sure.

mattww
Responsive Resident
Responsive Resident

Hi @Anonymous, glad to hear you got it to work, hopefully it was just something random and temporary going on in th model

 

If the expression is doing what you intended, please mark the post with that formula as solution, or do let me know if there's anything else I can help with

 

Thanks, Matt

Anonymous
Not applicable

Thanks for the quick reply. But when I am using 'If condition' does not show the "Table Column" for e.g "'Table[Task Name]'. Intellisense only shows me measures not "Table Columns".  Any idea why?

mattww
Responsive Resident
Responsive Resident

Hi @Anonymous, are you sure you're adding a Calculated Column and not a Measure?

 

mattww_0-1637083795170.png

 

Alternatively

 

mattww_1-1637083817676.png

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

See the below image. I am using a new calculated column. But it's just showing only Calc Measure not columns under sheet2 table. I may be missing something. 

AH1988_0-1637084340166.pngAH1988_1-1637084360003.png

 

mattww
Responsive Resident
Responsive Resident

Hi @Anonymous , that is a bit weird, it might just be your IntelliSense playing up, have you tried just typing out Sheet2[Task Name] = "Task", does that work? Do you get any red lines under the expression?

Anonymous
Not applicable

Not Working

 

AH1988_0-1637084792875.png

 

mattww
Responsive Resident
Responsive Resident

Hi @Anonymous 

 

I'm not too sure why it's doing that, it's working fine on my end. What's the error message?

 

Are you using Power BI Desktop? What's the data source?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.