Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
luciano1903
Frequent Visitor

MEDIDA DAX RETORNANDO COM VALORES DIVERGENTES

boa tarde

 

Pessoal criei uma coluna no PBI, nela ela calcula o tempo entre datas desconsiderando sábado e domingo, porém em algumas linhas ele retorna com o valor de 48 horas, não consegui identificar, onde está o erro. Exemplo: data de input 16/10/2023 e envio federação 17/10/2023, deveria retornar 24, porém o resultado é 48.

Agradeço pela ajuda.

luciano1903_0-1707245771163.png

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

The WEEKDAY(...,2) for these dates is 1 and 2.

View solution in original post

v-yilong-msft
Community Support
Community Support

Hi @luciano1903 ,

For Ibendlin's answer I think it's correct, in your DAX code, WEEKDAY([Date],2)<6,24 is counting by days, that is why it returns 48 only in 16/10/2023-17/10/2023.

If you want to change all the results to 24 that's fine too.

 

Column = 
VAR _A = SUMX(FILTER(CALENDAR('Table'[Data Input],'Table'[Data Output]),WEEKDAY([Date],2)<6),24)
VAR _AA = IF(_A = 48,24,_A)
RETURN _AA

 

vyilongmsft_0-1707272696222.png

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @luciano1903 ,

For Ibendlin's answer I think it's correct, in your DAX code, WEEKDAY([Date],2)<6,24 is counting by days, that is why it returns 48 only in 16/10/2023-17/10/2023.

If you want to change all the results to 24 that's fine too.

 

Column = 
VAR _A = SUMX(FILTER(CALENDAR('Table'[Data Input],'Table'[Data Output]),WEEKDAY([Date],2)<6),24)
VAR _AA = IF(_A = 48,24,_A)
RETURN _AA

 

vyilongmsft_0-1707272696222.png

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

The WEEKDAY(...,2) for these dates is 1 and 2.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.