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

Using a measure returning a date inside an IF function

Hello,

 

I have created a measure:

Date marker = VALUES(tblVisit[MaxDate])

The measure produces the correct result.

 

I want to use the measure inside an IF function in a new column (in a different table), something like:

IF(tbl[Date]>[Date marker],"y","n")

This gives me an error: 'A table of multiple values was supplied where a single value was selected'.

 

If I hard code a date everything works fine:

IF(tbl[Date]>DATE(2018,04,01),"y","n")

 

Is anyone able to let me know why using the measure does not work?

 

Cheers,

Mark

1 ACCEPTED SOLUTION

Accepted Solutions
67nmark Regular Visitor
Regular Visitor

Re: Using a measure returning a date inside an IF function

Hello,

Thanks for the reply. I have sorted the issue out - my problem was driven by a number of issues, the largest of which was that my date measure was formatted as text!!

Thanks again.

Cheers,

Mark

3 REPLIES 3
Ross73312 Super Contributor
Super Contributor

Re: Using a measure returning a date inside an IF function

From what I can tell, Date Marker is being used to return a list of dates.  When you enter your IF statement, you are checking if tbl[DATE] is greater than your list of dates.  Since you haven't provided a method of aggregation of that list, Power BI is unsure what you are trying to do.

 

The points I would raise here are:

 

  • How is [Date Marker] any different in logic to simply using tblVisit[MaxDate] inside a formula?  Is the date marker measure doing what you intended it to do?
  • What logic is your IF statement supposed to be?  Are you trying to get a list of dates and you want tbl[Date] to be greater than all of the dates aggregated together?
  • Reading your various measures, they are written more like custom columns.  I don't think this is what you intended.

   

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

Proud to be a Datanaut!


   


67nmark Regular Visitor
Regular Visitor

Re: Using a measure returning a date inside an IF function

Hello,

Thanks for the reply. I have sorted the issue out - my problem was driven by a number of issues, the largest of which was that my date measure was formatted as text!!

Thanks again.

Cheers,

Mark

Highlighted
67nmark Regular Visitor
Regular Visitor

Re: Using a measure returning a date inside an IF function

Hello,

Thanks for the reply. I have sorted the issue out - my problem was driven by a number of issues, the largest of which was that my date measure was formatted as text!!

Thanks again.

Cheers,

Mark

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 360 members 3,855 guests
Please welcome our newest community members: