Forum Discussion
DAX countrows Time inteligence
- 2 years ago
Realmente como você observou, fiz as devidas correções e pude ver as linhas sendo contadas.
Obrigado novamente.
Hi, jaylsonphb
Thank you very much for your reply. The reason why this measure doesn't work is because the calendar table has the hours, minutes, and seconds after the date are all 12:00:00, as shown in the following image:
This doesn't match the hours, minutes, and seconds after your actual date column, so it's shown empty:
So we can change the original DAX expression like this:
countID =
VAR vDiaUtil = SELECTCOLUMNS(FILTER('CALENDARIOPQ','CALENDARIOPQ'[DiaUtil]=1),'CALENDARIOPQ'[Data])
VAR vLegado = DATEDIFF(SELECTEDVALUE(fProdutividade[DataTratamento]),TODAY(),DAY)
RETURN IF(vLegado>=2,COUNTAX(FILTER(ALLSELECTED(fProdutividade),'fProdutividade'[Id_PREA]<=SELECTEDVALUE(fProdutividade[Id_PREA])&&DATEVALUE(FORMAT('fProdutividade'[DataTratamento],"MM/DD/YYYY")) IN vDiaUtil),'fProdutividade'[Id_PREA]))
In this DAX expression, I first use the format function to convert your date column to MM/DD/YYYY format. Since the format function returns a text date, I used the datevalue function. The main purpose of this function is to change the date of the text type to the date type, so that it can be compared with the vDiaUtil.
The results are as follows:
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Realmente como você observou, fiz as devidas correções e pude ver as linhas sendo contadas.
Obrigado novamente.