Forum Discussion
AnthonyDNY
3 years agoNew Member
Card Visual and Date Context
Hello, I have a measure to calculate logins on last business day. This works well provided it is in a table visual. Once I add this to a card visual, it stops working UNLESS I add a visual filte...
- Anonymous3 years ago
Hi AnthonyDNY ,
You can create a calendar table without weekends. And then add an index column to capture the previous working day. For example,
Table = var _tab=FILTER(CALENDAR(DATE(2022,12,1),DATE(2022,12,31)),WEEKDAY([Date],2)<>6&&WEEKDAY([Date],2)<>7) return ADDCOLUMNS(_tab,"Index",RANKX(_tab,[Date],,ASC,Dense))Today's Index = CALCULATE(SUM('Table'[Index]),FILTER(ALLSELECTED('Table'),[Date]=TODAY()))Previous Working Day = CALCULATE(SUM('Table'[Index]),FILTER(ALLSELECTED('Table'),[Index]=[Today's Index]-1))Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
3 years agoNot applicable
Hi AnthonyDNY ,
You can create a calendar table without weekends. And then add an index column to capture the previous working day. For example,
Table = var _tab=FILTER(CALENDAR(DATE(2022,12,1),DATE(2022,12,31)),WEEKDAY([Date],2)<>6&&WEEKDAY([Date],2)<>7)
return ADDCOLUMNS(_tab,"Index",RANKX(_tab,[Date],,ASC,Dense))
Today's Index = CALCULATE(SUM('Table'[Index]),FILTER(ALLSELECTED('Table'),[Date]=TODAY()))Previous Working Day = CALCULATE(SUM('Table'[Index]),FILTER(ALLSELECTED('Table'),[Index]=[Today's Index]-1))
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.