Forum Discussion
changing data format using r script in a power bi ssas live connection
I'm using measures and dimensions from a live ssas connection to create a data frame using R Script in Power BI Desktop. I'm using the data frame to create a geom_bar to show revenue against product categories. R script has recognised my revenue figures as a factor and not a numeric field and so even when I use stat = "identity", i'm getting bars which are of the same lenght and as.numeric doesn't work to change the format from a factor to a numeric field either. What can I do better? Please let me know. Thanks.
4 Replies
- Greg_DecklerCommunity Champion
Are you using R script in a R-Visaulization, an R-based Query or an R-step in a query?
- gopaltarakadFrequent Visitor
I'm using R Script for an R-Visualisation.
PS: Thanks for your response!
- Greg_DecklerCommunity Champion
In your query, can you flag your column as numeric?
- AlexChenMicrosoft Employee
Hi,
I hope you can check the parameter you sent to as.numeric and make sure they are numbers.
dataset$TaxAmt<- as.numeric(as.vector(dataset$TaxAmt))
If you still get errors, pls paste you detailed error message here.
Also I hope you can give out a sample table and your r script so that we can see what’s the issue clearly if possible.
Best Regards
Alex