Forum Discussion
good/bad condition derived from multiple dates
Dear reader,
I would like to ask for advice regarding the following:
Background info:
For orders we receive we keep track of multiple dates in an excel, which are consecutively:
1. date received
2. date rejected
3. date returned after rejection
4. acceptation date.
Between these dates there is a time limit for the processing time, which would be an interval of 10 workdays (excluding the date between 2-3).
Goal:
Creating an reporting visual on the dashboard stating a ‘good/bad’ status for each order. The status would be good if the time limit for each interval would not have been met, i.e.:
Conditions for the status being ‘good’ would be:
1-4 < 10 workdays
Conditions for the status being ‘bad’ would be:
1-4 > 10 workdays
1-2 > 10 workdays
3-4 > 10 workdays
Between these orders there may be cases when there is no rejection. Fields in the excel would be filled with “N/A”
So far:
I created a Calendar with a column that shows workdays showing either a 1 or a 0, with a 1 showing for workdays.
Workday = IF(OR('Date'[DayOfWeekNumber]=1;'Date'[DayOfWeekNumber]=7);0;IF(ISBLANK('Date'[Holiday]);1;0))
In the table with the orders I added some columns to calculate the difference in workdays between the different dates (1-2, 2-3, 3-4 and 1-4) showing me the number of workdays between two dates.
1-4 =
calculate(
countrows('date');
DATESBETWEEN('Date'[Date];'RI-2020'[date received]; 'RI-2020'[acceptation date]);
'Date'[Workday])
and
2-3 = if('RI-2020'[date rejected]="N/A";BLANK();calculate(countrows('date');DATESBETWEEN('Date'[Date];'RI-2020'[date returned]; 'RI-2020'[date rejected]);'Date'[Workday]))
For giving me blank fields when there is no date applied.
Critical part (for me ;):
I just can’t seem to string together a formula that would show me the previously stated good or bad conditions.
For a single statement it would be quite easy, something like:
if('RI-2020'[1-4]<10; "good"; "bad")
Adding all the bad conditions to this formula is where I find myself lost. Also including the blank fields
Any link to similar problems, help or advice would be greatly appreciated.
Refer to the file on how I have calculated working days. Context is very important meaure, so you need to have values in calculating or use summarize.
Working Days = CALCULATE(Sum('Date'[Working day]),VALUES('Order Dim'[Order No]),filter(all('Date'),'Date'[Date]>=[Min Order Date OD] && 'Date'[Date] <=[Max Deilvery OD]))You can try having same calculation has a column. Check the order dim in data view
Working Day Way2 = sumx(filter('Date','Date'[Date]>='Order Dim'[Way 1 Order Date] && 'Date'[Date]<='Order Dim'[Way 1 Delivery Date]),'Date'[Working day])Attach file has examples for workday calculation refer to page 2 visual. There 4 different ways date diff is done. They are for all days, but still refer in way 4 how summarized has been used.
Refer :https://www.dropbox.com/s/y47ah38sr157l7t/Order_delivery_date_diff.pbix?dl=0
2 Replies
- amitchandakSuper User
Refer to the file on how I have calculated working days. Context is very important meaure, so you need to have values in calculating or use summarize.
Working Days = CALCULATE(Sum('Date'[Working day]),VALUES('Order Dim'[Order No]),filter(all('Date'),'Date'[Date]>=[Min Order Date OD] && 'Date'[Date] <=[Max Deilvery OD]))You can try having same calculation has a column. Check the order dim in data view
Working Day Way2 = sumx(filter('Date','Date'[Date]>='Order Dim'[Way 1 Order Date] && 'Date'[Date]<='Order Dim'[Way 1 Delivery Date]),'Date'[Working day])Attach file has examples for workday calculation refer to page 2 visual. There 4 different ways date diff is done. They are for all days, but still refer in way 4 how summarized has been used.
Refer :https://www.dropbox.com/s/y47ah38sr157l7t/Order_delivery_date_diff.pbix?dl=0
- amitchandakSuper User
If the above solution not able to help you how to get the solution.
Then; can you share sample data and sample output? If possible please share a sample pbix file after removing sensitive information.