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
DebbieE
Community Champion
Community Champion

DAX If Date is Greater than Date then 0 else 1

I tried creating the following DAX Column
Max OMS Date Flag = IF('dim Date'[date].[Date]'>=[MAX Date],0,1)
Because I want to use this as a filter for a visual but I get the expression refers to multiple columns. Multiple columns cannot be converted to a scalar value
 
I clearly need to change this DAX query because I cant say where the date in the dim table is greater than or equal to my max date but Im not sure how
1 ACCEPTED SOLUTION

Create a calculated colunm and use the following dax changing the table and colunm names to your own 

 

checkdate =
--get the maxdate from table2
Var d2 = max(Table2[DATE])
var ret = if(Table1[Date] >= d2, 0,1)

return ret




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@DebbieE what you are trying to achieve? Your question is not fully clear.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

DebbieE
Community Champion
Community Champion

I tried creating the following DAX Column
Max OMS Date Flag = IF('dim Date'[date].[Date]'>=[MAX Date],0,1)
Because I want to use this as a filter for a visual but I get the expression refers to multiple columns. Multiple columns cannot be converted to a scalar value
 
I think the above is fairly clear
 
I clearly need to change this DAX query because I cant say where the date in the dim table is greater than or equal to my max date but Im not sure how
 
I need A DaX Query  to set the flag. If my date is greater than the max date in another table set to 0 else set to 1

Create a calculated colunm and use the following dax changing the table and colunm names to your own 

 

checkdate =
--get the maxdate from table2
Var d2 = max(Table2[DATE])
var ret = if(Table1[Date] >= d2, 0,1)

return ret




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.