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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
IanDixon
New Member

Calculated field using DAY(TODAY()) not updating in PowerBI Service

HI,

 

Part of my data is produced on the 15th of the month, basically on the 15th anything not entered is automatically updated by the appilication as "Missing".

 

I have a gateway from the Power BI service to the application database which refreshes the data on a daily basis or when refresh is clicked.

 

As the missing data isnt updated to the 15th of the month in the database, using the standard Month to work out aging wasn't working (or at least i couldn't figure it out) so I have a calculated field which uses an IF statement and DAY(Today()) < 15  to work out the aging of missing data.

 

Aging = IF(DAY(TODAY()) < 15, SWITCH (
TRUE (),
vwWOTimeLiveLeftHours[AGEMONTHS] >= -1, "0 Current",
vwWOTimeLiveLeftHours[AGEMONTHS] <= -2
&& vwWOTimeLiveLeftHours[AGEMONTHS] >= -3, "1 - 3 Months",
vwWOTimeLiveLeftHours[AGEMONTHS] <= -4
&& vwWOTimeLiveLeftHours[AGEMONTHS] >= -6, "4 - 6 Months",
vwWOTimeLiveLeftHours[AGEMONTHS] <= -7, "7 + Months", ""
), SWITCH (
TRUE (),
vwWOTimeLiveLeftHours[AGEMONTHS] >= 0, "0 Current",
vwWOTimeLiveLeftHours[AGEMONTHS] <= -1
&& vwWOTimeLiveLeftHours[AGEMONTHS] >= -3, "1 - 3 Months",
vwWOTimeLiveLeftHours[AGEMONTHS] <= -4
&& vwWOTimeLiveLeftHours[AGEMONTHS] >= -6, "4 - 6 Months",
vwWOTimeLiveLeftHours[AGEMONTHS] <= -7, "7 + Months", ""
))

 

AGEMONTHS is just the standard DATEDIFF

 

AGEMONTHS = DATEDIFF(vwWOTimeLiveLeftHours[DATENOW],vwWOTimeLiveLeftHours[PeriodBooked],MONTH)

 

When using Power BI Desktop this field updates automatically whenever the data is refreshed and the aging is correctly shown for the data on the report and dashboards. AGEMONTHS is show correctly and the Aging is Correct based on the caculated field,

 

In the Published report on the Power BI Service, AGEMONTHS is updated correctly based on the current date, 

 

The problem is that DAY(Today()) is the Day last time the report was refreshed on the Desktop PowerBI and published to the Power BI Service and not the current Day. For some reason DAY(Today()) is not reflecting the current Day of the Month on the Power BI Service.

 

New data is assigned into Aging buckets  though based on the last time the report was published to the service not the current Day, so the IF/Switch Statement is working, but just with the incorrect Day.

 

Any one encountered this problem ?

 

 

4 REPLIES 4
Greg_Deckler
Super User
Super User

Is Aging a Column or a Measure? I assume Column.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Yes Aging is a column

HI @IanDixon,

 

I'd like to suggest use UTCTODAY and UTCNOW to calculate datetime with UTC format. (AFAIK, current service will analyze datetime as UTC format)

Power BI Desktop February Feature Summary

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi there, is the report being refreshed daily?

The reason that I ask is that the dashboard would need to be refreshed daily for it to calculate the new TODAY()




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors