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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Applicable88
Impactful Individual
Impactful Individual

Datediff and row context

Hello, 

 

I have question regarding the datediff() function. In the syntax it is not mentioned that its a iterator. But why it works in a measure like this:

Ampel =
VAR _dur =
DATEDIFF (
MAX( Orders[Date] ),
Max(LastRefresh[LastRefreshUTC]),
DAY
)
RETURN
SWITCH (
TRUE (),
_dur < 0, "#09ff00", /Greencoulor
_dur =0, "#ffdd00",//Yellocolour
"#ff0000" //Redcolour
 
If i would put it directly like this:
if ( Order[Date]< today()...... and so fourth
its not going to work since its like comparing to a "naked column" and the fields are grayed out.
 
Even the max(order[date]) above is actually delivering a scalar value and shoulnd't it only consist of the last date available in my date table?
 
Best.  
1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Applicable88 not sure if I fully understood your question. MAX date will not necessarily return the MAX date in your calendar table it will return in the row filter context.

 

If you are looking at the data at the month level, the max date will of that month, the same data you are looking at by week, the max date will be the max of that week, and so forth so on.

 

It is always good to provide some sample data and how you are visualizing to provide more context to the problem. MAX date doesn't mean anything until you define in what context you are looking at it.



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.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@Applicable88 not sure if I fully understood your question. MAX date will not necessarily return the MAX date in your calendar table it will return in the row filter context.

 

If you are looking at the data at the month level, the max date will of that month, the same data you are looking at by week, the max date will be the max of that week, and so forth so on.

 

It is always good to provide some sample data and how you are visualizing to provide more context to the problem. MAX date doesn't mean anything until you define in what context you are looking at it.



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.

parry2k
Super User
Super User

@Applicable88 where you see it says iterator, it takes scalar values

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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.

Hi @parry2k , thats the question. Since its not a iterator function and only put in a variable inside a measure, how can it operate? isn't it comparing one naked column two another naked column this way?  

 

It't the same like  when you want to use the If-statements  in a measure, it only works when wrapped up inside the conditional part of a another x-aggregated function. 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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