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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Nickgastaldi
Resolver I
Resolver I

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

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

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.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

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.
v-piga-msft
Resident Rockstar
Resident Rockstar

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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