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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
AnthonyDNY
New 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 filter of  'Relative Date' is in this day

 

Here is the measure:

 

Last Business Day Counts  =
            CALCULATE(
                     [Distinct Login Counts],   -
                     _Calendar[Date] = MAX(_Calendar[PriorWorkDay]
            )

I would like to make it so it works in card visual without using the viusal filters. I believe the question is - How do update the meausure so it knows to always use today? Here is a screen shot of the table, you can see the measure works in this visual.
 
Any help would be appreciated. 
AnthonyDNY_0-1670249985952.png

 

 
 
 
 
 
 

 

1 ACCEPTED SOLUTION
Anonymous
Not 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))

vstephenmsft_0-1672128400947.png

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))

vstephenmsft_1-1672128646593.png

 

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.

View solution in original post

3 REPLIES 3
Anonymous
Not 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))

vstephenmsft_0-1672128400947.png

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))

vstephenmsft_1-1672128646593.png

 

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.

djurecicK2
Super User
Super User

Hi @AnthonyDNY ,

 You can try something like this:

 

Today Counts  =
            CALCULATE(
                     [Distinct Login Counts],   -
                     _Calendar[Date] = TODAY()
            )
 
Please accept as solution if this answers the question- thanks!

Hi, 

 

I realize now I did not phrase the questioin clearly. I need the card visual to show last business day counts, not today's counts. So today being Monday, December 5th 2022, I want the card visual to show me counts for Friday, December 2nd, 2022.

 

Thanks

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.