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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
cmsouth
Frequent Visitor

R Visual Script Auto Run to save historical data

I've created an R script in a Visual to summarize some key data and save it each day, for trend reporting.  I used the R Script on a Visual approach instead of an R script in a query because i have created DAX columns that I want to use in the visual, and those fields are not available at PowerQuery time.  I want to run the script each time the report is refreshed, which would be done automatically if the Script was a connection query.

Has anyone found a way to autorun a script in a Visual?  I figured i will only be able to schedule in the Personal Gateway and not the On-Premises, but I can deal with that for a few reports that need to run weekly.  

1 ACCEPTED SOLUTION

Hi @cmsouth ,

 

According to my testing, the R visual scripts do not run automatically when the dataset is refreshed, so you cannot achieve automatic saving of historical data of visuals. It is recommended that you use M instead of DAX to calculate the final result and then use R scripts in Power Query to store the historical data. 

Or you can use the Report Builder to connect to the datasets on the Service, then create paginated reports and subscribe to them.

 

Best Regards,
Winniz
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

5 REPLIES 5
cmsouth
Frequent Visitor

What a horrible answer.  I'll look elsewhere....

Hi @cmsouth ,

 

According to my testing, the R visual scripts do not run automatically when the dataset is refreshed, so you cannot achieve automatic saving of historical data of visuals. It is recommended that you use M instead of DAX to calculate the final result and then use R scripts in Power Query to store the historical data. 

Or you can use the Report Builder to connect to the datasets on the Service, then create paginated reports and subscribe to them.

 

Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

cmsouth
Frequent Visitor

As mentioned, I want to save report data after it is refreshed so i can report on historical results - i want to trend $/Counts/etc on summary data. For example, I have created a formula that calculates what stage an order is in and another that summarizes how many orders are in that stage TODAY.  I want to report if we are getting fewer or more orders in that stage.
I have a few DAX formulas that I've created in my data that are used in the report/ visual, so i want to save that data after the refresh (I save it now using R-Script back to a MySQL table by date).  Then i can pull that historical in and create a bar chart by date.
I would like to leverage the formulas already created, but am option to other methods to accomplish my objective....

Power BI is not the right tool for that. It has no memory.  Use a different process to capture your historical snapshots.

lbendlin
Super User
Super User

you are trying to mix concepts that cannot be mixed. Visuals are rendered in a number of scenarios, but none of them include a dataset refresh.

 

Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where you are stuck?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors