Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hello - I have the following measure in a table. The measure tells me if a shipment is on time or late (not counting weekends), and it works perfectly fine for that. However, it ignores any type of filter or slicer either from another visual or from the filter menue. The visuals below show how it looks without, and with this measure applied.
Any idea how to fix this or create a measure/column without this issue?
Hi @Anonymous,
I just updated the formula of your measure, please try this:
New AR On Time Late Measure = VAR _due = SELECTEDVALUE('Flu Shipped'[Due Date]) VAR _shipped = SELECTEDVALUE('Flu Shipped'[Date Shipped]) VAR _datediff = if(_shipped<_due,"on time",if(CALCULATE(COUNTROWS(DateTable),FILTER(DateTable,DateTable[Date]>=_due&&DateTable[Date]<=_shipped&&WEEKDAY([Date],1)<6))<=3,"On Time","Late" ) ) RETURN _datediff |
Best Regards
Rena
Hi Rena,
I was mistaken earlier - your measure is not properly assigning Late or On Time (taking into account only weekdays).
Also, after playing around with your formula, it seems the reason it does not respond to the Date Table filters (such as Year, Month, Day) is that the Selected Values are on the date shipped and due date. If I change these to Date Table,Date then my applied filters actually work. Your example where you selected on specific date is not workable for my situation as I will only filter at the Year, Month, Week or Day level using the filters from chart visual (using the date table values of Month, Week, Day, etc).
Can the formula be adjusted?
Hi @Anonymous ,
Whether your problem has been resolved?
Best Regards
Rena
Hi @Anonymous,
I made a little mistake(see the part with red font) about the judgment on whether it is a weekend in my previous formula. Here is the corrected formula:
New AR On Time Late Measure = VAR _due = SELECTEDVALUE('Flu Shipped'[Due Date]) VAR _shipped = SELECTEDVALUE('Flu Shipped'[Date Shipped]) VAR _datediff = if(_shipped<_due,"on time",if(CALCULATE(COUNTROWS(DateTable),FILTER(DateTable,DateTable[Date]>=_due&&DateTable[Date]<=_shipped&&WEEKDAY([Date],2)<6))<=3,"On Time","Late" ) ) RETURN _datediff |
So currently you want to use the date hierarchy of Date table to filter the data ? I don't understand why the date of this table is used for data filtering... Anyway, could you please try to updated the above formula according to your date filtering requirements and check if it can achieve your requirements.
Best Regards
Rena
Hi Rena - Several people have tried to help (which I really appreciate!) but so far none of the solutions are working, including yours.
Here is a very basic calculated column that does at least allow for the table to be properly filtered.
Try like
New AR On Time Late Measure =
VAR _due = minx(allselected('Flu Shipped'),'Flu Shipped'[Due Date])
VAR _shipped = maxx(allselected('Flu Shipped'),'Flu Shipped'[Date Shipped])
VAR _datediff =
CALCULATE(COUNTROWS(DateTable),FILTER(DateTable,DateTable[Date]>=_due&&DateTable[Date]<=_shipped&&DateTable[Weekday2]<6))
RETURN IF(_datediff<=3,"On Time","Late")
Hi Amit,
Thank you for the help...but this measure is still ignoring my date table filters.
The Date Shipped and Due Date are both in the Flu_Shipped table....and the relationship is between Date Shipped and Date on the date table.
If I use a very basic calculated column like this, it allows my chart visual to properly cross filter my table. Not sure why this works, but the measures do not. For some reason, there is something in the Measure that is causing it to ignore the Year, Month, and Day from the date table. I have those elements on my chart visual, and when I drill down...the table should correspond to whatever the applied filter is at the current hierarchy. But when I apply the measure it does not respond at all to any filters from the Date Table. This basic caclulated column does though...
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
Check out the May 2024 Power BI update to learn about new features.
User | Count |
---|---|
90 | |
79 | |
61 | |
60 | |
58 |
User | Count |
---|---|
151 | |
113 | |
99 | |
80 | |
72 |