Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Solved! Go to Solution.
Hi @zaidmasad,
You can take a look a below formula which used to get transmit date range(except the situational dates)
Calculated column: get date range except specify date and normal holiday(saturday and sunday)
Detail = var calendarTable= CALENDAR([Start Date],[End Date]) var exceptDate=CALCULATETABLE(VALUES(Sheet3[situation Date]),FILTER(ALL(Sheet3),[Entity]=EARLIER(Sheet2[Origin Entity])||[Entity]=EARLIER(Sheet2[Destination Entity]))) var filtered=ADDCOLUMNS(EXCEPT(calendarTable,exceptDate),"Day Of Week",WEEKDAY([Date],1)) return CONCATENATEX(FILTER(filtered,[Day Of Week]<>1&&[Day Of Week]<>7),[Date],",")
Count =
var calendarTable= CALENDAR([Start Date],[End Date])
var exceptDate=CALCULATETABLE(VALUES(Sheet3[situation Date]),FILTER(ALL(Sheet3),[Entity]=EARLIER(Sheet2[Origin Entity])||[Entity]=EARLIER(Sheet2[Destination Entity])))
var filtered=ADDCOLUMNS(EXCEPT(calendarTable,exceptDate),"Day Of Week",WEEKDAY([Date],1))
return
COUNTROWS(FILTER(filtered,[Day Of Week]<>1&&[Day Of Week]<>7))
>>Also some of the countries have weekend as Saturday and Sunday, the other have weekends as Friday and Saturday.
You need to create a table to store these specific day of week, then excluded from current date range.
Regards,
Xiaoxin Sheng
HI @zaidmasad,
You can use below formula to calculate the transit time except the holiday.
Count = COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR([Start Date],[End Date]),"Day Of Week",WEEKDAY([Date],1)),[Day Of Week]<>1&&[Day Of Week]<>7))
In addition, I'm not so sure how to use the situational date table, can you share some detail information?
Regards,
Xianxin Sheng
@v-shex-msft Also some of the countries have weekend as Saturday and Sunday, the other have weekends as Friday and Saturday. Can this be included in the calculation? Thank you very much for your help
Hi @zaidmasad,
You can take a look a below formula which used to get transmit date range(except the situational dates)
Calculated column: get date range except specify date and normal holiday(saturday and sunday)
Detail = var calendarTable= CALENDAR([Start Date],[End Date]) var exceptDate=CALCULATETABLE(VALUES(Sheet3[situation Date]),FILTER(ALL(Sheet3),[Entity]=EARLIER(Sheet2[Origin Entity])||[Entity]=EARLIER(Sheet2[Destination Entity]))) var filtered=ADDCOLUMNS(EXCEPT(calendarTable,exceptDate),"Day Of Week",WEEKDAY([Date],1)) return CONCATENATEX(FILTER(filtered,[Day Of Week]<>1&&[Day Of Week]<>7),[Date],",")
Count =
var calendarTable= CALENDAR([Start Date],[End Date])
var exceptDate=CALCULATETABLE(VALUES(Sheet3[situation Date]),FILTER(ALL(Sheet3),[Entity]=EARLIER(Sheet2[Origin Entity])||[Entity]=EARLIER(Sheet2[Destination Entity])))
var filtered=ADDCOLUMNS(EXCEPT(calendarTable,exceptDate),"Day Of Week",WEEKDAY([Date],1))
return
COUNTROWS(FILTER(filtered,[Day Of Week]<>1&&[Day Of Week]<>7))
>>Also some of the countries have weekend as Saturday and Sunday, the other have weekends as Friday and Saturday.
You need to create a table to store these specific day of week, then excluded from current date range.
Regards,
Xiaoxin Sheng
@v-shex-msft Hello again,
I still have a problem with calculating the transit time, now the formula to exclude situational dates is working well. but I need a formula to exclude holidays based on the country.
I have a table for holildays that looks as below for the entities regardless if it is a destination or origin:
What should the new formula for calculating the tranist time be?
Thank you very much for your help.
Hi @v-shex-msft,
Can you please explain me exactly how does this function work? I am new to these kind of function and powerBI.
Thank you very much
Hi @zaidmasad,
Some comment of the formula:
Detail = var calendarTable= CALENDAR([Start Date],[End Date]) //use "start date" and "end date" from current row content to create a calendar table. var exceptDate=CALCULATETABLE(VALUES(Sheet3[situation Date]),FILTER(ALL(Sheet3),[Entity]=EARLIER(Sheet2[Origin Entity])||[Entity]=EARLIER(Sheet2[Destination Entity]))) //use current "origin entity" and "destination entity" to filter situation date from situation table. var filtered=ADDCOLUMNS(EXCEPT(calendarTable,exceptDate),"Day Of Week",WEEKDAY([Date],1)) // add "day of week" column to calendar table(it used to filter normal holiday) return CONCATENATEX(FILTER(filtered,[Day Of Week]<>1&&[Day Of Week]<>7),[Date],",") // filter date and merge them to text
COUNTROWS(FILTER(filtered,[Day Of Week]<>1&&[Day Of Week]<>7)) //filter date and get count of days.
BTW, you can also refer to below link which about dax functions:
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |