Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone,
I need to find a way to a dax formula for calculated column in a Calendar table which computes the "next working day" in the same table.
Basically i need to get the minimum DATE value, where IsWorkingDay is Y and DATE value is equal to or greater than the DATE fo current row - see attached image.
I tried some solutions but none worked 😞 (I admit i am quite new to DAX.. need to improve "on the job")
Help appreciated!
Thanks in advance
Solved! Go to Solution.
HI @bugs84
Hopefully this shall do the job
ThisOrNextWorkingDay = VAR NextWorkingDay = MINX ( FILTER ( TableName, TableName[Day] > EARLIER ( TableName[Day] ) && TableName[IsWorkingDay] = "Y" ), TableName[Day] ) RETURN IF ( TableName[IsWorkingDay] = "N", NextWorkingDay, TableName[Day] )
Is there any way to use this measure as a calculated column in the fact table but the dates of next working day refers to customised date table?
HI @bugs84
Hopefully this shall do the job
ThisOrNextWorkingDay = VAR NextWorkingDay = MINX ( FILTER ( TableName, TableName[Day] > EARLIER ( TableName[Day] ) && TableName[IsWorkingDay] = "Y" ), TableName[Day] ) RETURN IF ( TableName[IsWorkingDay] = "N", NextWorkingDay, TableName[Day] )
I just joined the pwbi community to thank you for this. 5 years after posting and still a simple and valid solution.
It worked!!
Actually since i have a few rows, i guess removing the "IF" and making the measure a little simpler can be fine too.
Thanks a lot!!
ThisOrNextWorkingDay =
MINX (
FILTER (
ZDate;
ZDate[Date] >= EARLIER ( ZDate[Date] )
&& ZDate[IsWorkingDay] = "S"
);
ZDate[Date]
)
Hi @Zubair_Muhammad this worked great!
I have a very large date table though and this seems to take quite some time to load, is there another way to do this for large date tables?
User | Count |
---|---|
75 | |
71 | |
42 | |
31 | |
28 |
User | Count |
---|---|
99 | |
92 | |
50 | |
49 | |
46 |