cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nickgastaldi Regular Visitor
Regular Visitor

Comparing Date from Var not updating day by day

Hello Community,

 

dashboard is running on DirectQuery in a sqlserver .

 

What i want to do is count the IDs from my log/historical table in the lastupdatedate 7 days ago, in a time window of 1 hour. 
all this is working, no problem, the problem is, after midnight, the VARs continue to return yesterday values, they dont update to "today" 

 

VAR MAXTIME = CALCULATE(MAX(lastUpdateTimer[timekey])) -- 100s means hours, 10s means minutes.
VAR MAXDATE = CALCULATE(max(lastUpdateTimer[lastUpdateDate])) -- simple date
Return

   CALCULATE(
           DISTINCTCOUNT(fLocalizacao_historico_30dias[id])
           ,fLocalizacao_historico_30dias[SimpleDate] = MAXDATE-7
           ,fLocalizacao_historico_30dias[TimeKey] >= FORMAT(VALUE(MAXTIME - 100),"####")
           && fLocalizacao_historico_30dias[TimeKey] <= MAXTIME
           )

 if i open the PBIX file, go to powerquery window, and hit the refresh all, everything goes back to work, else, it just remains "Blank". 

Any thoughts? 

 

i read on some places that once a variable is set, it just keeps re-using its value, but how to make it update when there is an update? 

 

big thanks

2 REPLIES 2
Community Support Team
Community Support Team

Re: Comparing Date from Var not updating day by day

Hi @Nickgastaldi,

 

Based on your description, it seems that the measure works as expected. 

 

For the var value in Direct Query, it will update when have a calculate or have a refresh.


i read on some places that once a variable is set, it just keeps re-using its value, but how to make it update when there is an update? 

For your scenario, you should hit a refresh to update the measure or re-use the measure.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Community Support Team
Community Support Team

Re: Comparing Date from Var not updating day by day

Hi @Nickgastaldi,

 

Have you solved your problem?

 

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.