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
copykai
Resolver I
Resolver I

Publish to web hourly cache hack

The publish to web cache acts super weird and it not at all consistent. It states that the cache takes up to 60 minutes to clear which is definitely not something you can rely on.

I have a report that is published to web. Why? Because it shows the Danish electricity prices and is available to everyone. This information is actually not broad and well-known and I believe it might have something to do with bureaucracy and the non-willingness of energy companies to be transparent.

 

There were some problems where if the report were accessed at 12.50, new data came in 12.55, data was refreshed at 13.00, then it would wait until 13.55 before it had removed the cache and was able to show the new data.

I needed it to be updated every hour and came up with an idea.
You can use javascript to paramatize the iframes and I solved it with this code:

<html>
<head>
<title>Title</title>
</head>
<body>
<iframe id = "dynamicframe" title="EnergiNetV2" width="100%" height="100%" src="" frameborder="0" allowFullScreen="true"></iframe>



<script>
const hour = new Date().getHours(); 
let link;

if (hour % 2 == 0) {
 document.getElementById("dynamicframe").src="Link 1";
} else {
 document.getElementById("dynamicframe").src="Link 2";
}

</script>
</body>
</html>

 

 Of course you would need to setup two identical reports and datasets that has the exact same data and visuals.
But every even hour it shows report 1 and every odd hour it shows report 2.
This will simulate a hard cache reset every hour. If you need more refreshes you can expand it by minute, I guess.

At least it solved my issue and I can rely that new data shows at every hour.

1 ACCEPTED SOLUTION
v-yetao1-msft
Community Support
Community Support

Hi , @copykai 

Thanks a lot for your sharing. I think you should be very willing to share this matter with more users.

Please consider Accept it as the solution to help the other members find it more quickly .

 

Best Regards,
Community Support Team _ Ailsa 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

1 REPLY 1
v-yetao1-msft
Community Support
Community Support

Hi , @copykai 

Thanks a lot for your sharing. I think you should be very willing to share this matter with more users.

Please consider Accept it as the solution to help the other members find it more quickly .

 

Best Regards,
Community Support Team _ Ailsa Tao
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.

Top Solution Authors
Top Kudoed Authors