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
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
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.