Forum Discussion
Adding working days
- 4 years ago
Hi Anonymous
Relationships will propagate filters between tables so it is not allowed to have multiple active relationships between tables to avoid ambiguity. If you are not familiar with active/inactive relationships, you can refer to this guide: Active vs inactive relationship guidance
In addition, the RELATED function requires that an active relationship exists between the current table and the table with related information. If you want to get the +7 working date according to Relance 2 or Relance 3, you can try below code. This code is not dependent on the relationship.
Column 2 = MAXX ( FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] = EARLIER ( 'Tracking (2)'[RELANCE 2] ) ), 'Calendar'[+ 7 Working Days] )If this is not what you want, can you please show what you want to do with Relance 2 and Relance 3?
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hello Anonymous ,
First of all please ensure that you're using the inbuilt date functionalities in Power BI to compute working days, rather than using an external lookup file.
In Power Query, add the following column to your date table (calendrier)
Assuming Monday as the first day of the week, it is assgined a value of 0. Hence, Saturday and Sunday have values 5 and 6 respectively.
You now get the column Jours ouvrés without using an external lookup.
I have assumed hat your Tracking table looks like below
In the report view, create a 1:M relationship between your date table and the Tracking table
Once this relationship has been created, go to your Tracking table and add a new column based on the relationship created above. This will give you the weekday flag as a column on the Tracking table
Next, based on your requirement add a new column. To add 7 days to the given date use
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊
Thank you so much.
It's not working though, it says The "DATEADD" function expects a contiguous selection when the date column is not unique, is discontinuous, or contains a time part.
- rohit_singh4 years agoSolution Sage
Hi Anonymous ,
Please ensure that your date columnis formatted as date and not date/time.Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊- Anonymous4 years agoNot applicable
Hello rohit_singh,
I Checked and the column is in Date and not Date time but It may be because the column of dates is discontinued (sometimes there are dates, sometimes it's empty).
I did it many times in different ways, I don't always get the message but in any case it doesn't add the days, the column where it's supposed to be +7 days is completly empty.
- v-jingzhang4 years agoCommunity Support
Hi Anonymous
I create a sample demo attached at bottom. See if it helps.
First create a new column in the calendar table to get the +7 working date for every date.
+ 7 Working Days = MAXX ( TOPN ( 7, FILTER ( 'Calendar', 'Calendar'[Date] > EARLIER ( 'Calendar'[Date] ) && 'Calendar'[IsWorkingDay] = 1 ), 'Calendar'[Date], ASC ), 'Calendar'[Date] )Then in 'Tracking' table, get the +7 working date with RELATED function.
The relationship between two tables as below.
If 'RELANCE 1' value is blank, it returns blank too.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.