Forum Discussion

gopaltarakad's avatar
gopaltarakad
Frequent Visitor
10 years ago

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_Deckler's avatar
    Greg_Deckler
    Community Champion

    Are you using R script in a R-Visaulization, an R-based Query or an R-step in a query?

    • gopaltarakad's avatar
      gopaltarakad
      Frequent Visitor

      I'm using R Script for an R-Visualisation.

      PS: Thanks for your response!

  • AlexChen's avatar
    AlexChen
    Microsoft 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