Quantcast
Channel: All Developer posts
Viewing all 50477 articles
Browse latest View live

Re: R script to read query/table

$
0
0

Hi ,

Are you using the R script visual? If so, the data is exposed a dataframe named dataset. Please refer to step #3 in this linked article for reference.

As long as your field name is Col1 then the following would work:

x <- dataset$"Col1"

I've tested with a recent dataset, and the editor will show any fields as part of autocomplete, e.g.: for my test dataset:

image.png

Note this code doesn't fully work in Power BI Desktop as it doesn't produce a plot (yet) but it does work if I debug in RStudio, e.g.:

image.png

Hopefully this should be all you need.

Good luck!

Daniel


Re: R Custom Visual - Setting colours for each value in a field/column

$
0
0

Hi again Daniel,

 

Thanks very much for having a look at it - I appreciate the time you spent trying to get it working. It looks like I'm not going mad after all and can't set colours the way I wanted to be able to (unless the visuals team has some insight on how to do it). I may just end up doing something simple like passing in a colour theme based on some enumerated values (which is a bit too much like hard-coding for my taste).

 

I'll post any information I can gather here in case someone else runs into the same issue.

 

Thanks again.

 

Frank

Re: R script to read query/table

$
0
0

Thanks, but I am using just an R script not visuals. I need to save the table as an csv file using R script.

Re: R script to read query/table

$
0
0
Hi - can you please advise where in Power BI Desktop you're running the script? Presumably Power Query if not within visuals?
Thanks,
Daniel

Re: R script to read query/table

$
0
0

Yes, within query. 

It works within visuals. However I would like to do some data analysis in R and then save it.

KPI Indicator custom visual in json theme

$
0
0

Can anyone help me with the json theme for KPI Indicator custom visual in json?

I was trying to pass the  visual as KPIIndicator but as in json we already have KPI so it is not working.

Re: R script to read query/table

$
0
0

Righto - you'd do something like this (assuming the destination directory exists):

image.png

If the destination directory doesn't exist, you'll get a script error. Once you click okay, you'll get a .csv file in the specified directory, e.g.:

image.png

Here's an article that explains in more detail.

Regards,

Daniel

Re: R script to read query/table

$
0
0

The article does not tell what the "dataset" is))

The whole point of my question is this "dataset":

the error here is: Error in is.data.frame(x) : object 'dataset' not found

 

I need to take a table or another query or another data within Power Bi


Re: R script to read query/table

$
0
0

Can you please perhaps post an example of your query/R code? I tested the above with a query I had open in Power BI Desktop and it worked as documented.

The R Script transformation exposes the current step's data as an dataframe called dataset, which should be all you need, unless there is a specific transformation in your query that alters this?

Thanks,

Daniel

Re: R script to read query/table

$
0
0

There is no code to share:

I have one SQL query (which is saved as a table) and I need to save it using R script.

 

So simple, isn't it?

 

What is dataset, who creates it? I have no idea.

Re: Uploading PBIX File in C# sample (HELP!)

Re: Embedding reports with drillthrough

Capacity Calculation

$
0
0

Hi,

I'm fairly new to PBI. Please help me with greater detail.

Background:

In my organisation, we need to measure people's (across Australia) contribution. In order to do that we are capturing all task that they are completing on a daily basis. Each different task has allocated different time to it. In order to obtain their contribution, "Total time to complete all task" would be our Numerator.

In order to calculate contribution, we are required to know their capacity as well. A full time employee is working 7.5 hours a day. However, we need to exclude all leaves (annual leave, sick leave), all public holidays and weekends. Capacity would be our Denominator.

 

Current Process:

Currently we have calculated a flat % of all leaves and weekend portion and bring employee's working commitment down from 100% to say 60%! This 60% is then applied to their full capacity (7.5 hours) which brings their full time capacity for a day down to 4.5 hours for a day!

 

Current process Example: 

(A) Measure to calculate capacity =

CALCULATE(sum(Date_Tbl[IfWorkday]))*SUM(Employee[60% of Full Capacity])

(B) Measure to sum total time spent on tasks = 

CALCULATE(SUM('TBL SRs'[Timing(mins)]),'TBL SRs'[Task Name] = "Changing Client Details")

Measure to get contribution = DIVID(A,B,0)

 

Problem:

Above percentage calculation is based on a full year. However the issue is when management is looking at a quarter or even a month data how their staff is performing is not giving them an accurate picture as if we take a month example, there is not all public holiday falls within that month or not all leaves have been taken into that month and not all weekends (52) falls into that one month! So, looking at month or even quarter level view is not an ideal with this calculation as it's not flexible enough! I have a date table with column called "IsWorkDay" (value 0 or 1), to pick if a given date is a weekday or weekend? I can incorporate public holiday in the same way but people sometime works on the weekends (obviously they are not oblige to do so) and completed their task during weekend, this will not capture as part of their total effort as the system date stamp whenever they complete the task!

 

Desire solution:

I would like to consider all leaves, holidays and weekends to calculate their capacity but would like to include all works that has completed even they are not at work!

 

Sorry for long post but I though providing more detail would give greater understanding of the issue which leads to a quick solution!

 

Looking forward to getting help on this.

 

Thanks,

Brijesh

Re: R script to read query/table

$
0
0

It is simple Smiley Happy

The dataset dataframe is made available to the R Transform by Power Query.

I'll see if I can break down further by walking through - here's my query after I connect to a table in my database (supplying SQL in the connection dialog will produce something similar if it runs successfully):

image.pngSQL Results

I create a folder called test in the root directory of my hard disk, e.g.:

image.pngEmpty 'test' folder

In Power Query, I select Transform from the ribbon and then Run R script, e.g.:

image.pngInvoking the 'Run R script' transform

I'm now prompted to provide my code. The pre-filled comment in the text box tells me that dataset holds the input data (results of the previous step, i.e. my table), e.g.:

image.pngEmpty dialog weith pre-filled comment

I want to save the output from my SQL query as results.csv in the test subfolder I created earlier, so I add the code to do this. Because Power Query tells me I can use dataset for this, I can add this to my R code, e.g.:

image.pngUtilising the 'dataset' dataframe that Power Query has informed me about

When I click OK, my code will run. Here's what my query looks like now:image.png

I can then navigate to my folder to check I have a file:

image.pngresults.csv present in my folder

I can verify this is correct by opening it, e.g.:image.pngexported .csv in VS Code

Now I know this works, I can refresh my data in Power BI Desktop any time I like and the file will be overwritten in the target location, e.g.:image.pngFile after refreshing my data, with updated timestamp

I'm hoping that this clarifies things end-to-end.

Regards,

Daniel

Re: R script to read query/table


Integrate mvc application with premises powerbi dashboard

$
0
0

Good morning 

i have mvc application and need to connect to premises powerbi dashboard with api not with iframe  , i need to connect and authenticate with username and password and generate token and display the dashboard into the view , kindly anyone can help ?, thanks 

Operation returned an invalid status code NotFound

Re: Unable to see Power bi data set in power bi service

$
0
0

cloud data source, what are ways we can connect to entity store in D365 FO.

Re: Operation returned an invalid status code NotFound

$
0
0

Hi  

 

What are you trying to do ? Please explain along with your code 

Re: Need Cookie in my Rest API Custom data connector - Help please.

$
0
0

Same problem with the onpremise Conector via Logic App Custom Connector. Its not possible to pass the cookie Header Paramter to the api. 

 

#NoCookieParameterPassThroughAtCustomConnector

 

cookie never arrives at the api...

 

2019-08-20_18-50-10.jpg

 

Viewing all 50477 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>