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

Re: Remove spikes from data


Wrong Total

$
0
0

Good morning,

 

I am trying to get the Net pay on my bi report but it shows 64500.01 as my total netpay instead of 8826.7, I am not sure why this may be happening...please help.  Thank you!

 

Capture.PNG

Export-PowerBIReport giving error “Export-PowerBIReport : Operation returned an invalid status code

$
0
0

When I am trying to access Export-PowerBIReport to export .pbix report file I am getting error "Export-PowerBIReport : Operation returned an invalid status code 'NotFound'".

I have PowerBI PRO account. I have install all power BI modules.Below is the code I have used . Please suggest.

Connect-PowerBIServiceAccount$wrkSpace =Get-PowerBIWorkspace-Name'xxxx'$rep1 =Get-PowerBIReport-Name"Report Test1"-WorkspaceId $wrkSpace.id 
$rep1
$rep1ID =[guid]$rep1.Id$wrkSpace.id 
$temp_path ='C:\test\test1.pbix'Export-PowerBIReport-Id $rep1ID  -WorkspaceId $wrkSpace.id -OutFile $temp_path

 

Re: Wrong Total

Re: Wrong Total

$
0
0

Hi Greg,

 

I dont have any if's like 1000 above then total...I want a straight total.  How would I do that using your suggestion.?

Thanks for your help!

Combine table A with diferent columns

$
0
0

I have two tables:

Table A

ID.CUSTOMER//PRODUCT//DISCOUNT

1 // P1 // 1,2%

1 // P2 // 12,3%

 

Table B

ID.CUSTOMER//PRODUCT//SALES

1 // P1 // 100

1 // P2 // 200

1 // P3 // 300

 

How can I display a Power bi result with this info:

ID.CUSTOMER//PRODUCT//DISCOUNT//SALES

1 // P1 // 1,2%//100

1 // P2 // 12,3%//200

1 // P3 // ____//300

 

The main problem for me is because of P3 is not included i Table A.

 

Best Regards

 

Re: Remove spikes from data

$
0
0

Hello   and thank you for your answer!

It seems like a really good answer but I am not quite sure of what data it gets. Is there any modification that I can put in that piece of code to show me a graph (like the one I showed) and how it has been trimmed down? I hope I made sense. I am really new to DAX.

Re: Remove spikes from data

$
0
0

 - Well, to use that measure, you would replace the highlighted portion with your column name and you would need to replace the 'Table' reference with your table name. You would replace the .2 with the percentage of values that you want to trim off (top/bottom %)

 

TRIMMEAN =
VAR __Table =
ADDCOLUMNS(
'Table',
"Rank",RANKX('Table',[Value])
)

VAR __Percent = .2

 

After that, you would use this measure instead of what you are currently using in your visual.


Re: Wrong Total

Rest API Export Report to PDF that uses Azure Analysis Service as a data set

$
0
0

Hi;

I'm using the Rest API Call : POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/ExportTo.

 

I can successfully export a pdf report if the data is stored in PowerBI.

 

When I try to export a report to PDF that uses Analysis Service as it's Data Source
I then get the following Error : Export report requires effective identity to be provided for the report's data set.

 

What I have set up :
1. Premier Workspace where the PowerBI report is published
2. Followed the instructions to create a service principal and add it to power bi : https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal
3. The Service Principal has been added to the Azure Analysis Service Server as an Administrator
4. The Service Principal has been added to the Azure Analysis Service Database to a Role that has admin rights
5. Generate a Oauth Token :

grant_type:client_credentials
client_id: {My Client ID Generated in step 1}
client_secret:{Client Secret Generated in Step 1}
scope:openid
resource:https://analysis.windows.net/powerbi/api

6. Use the token received to call the Rest API Post Action : https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/ExportTo


Is there something else that needs to be done in order to allow the generation of the pdf when the data set is from a analysis service database ?

 

Thanks in Advance

Re: Wrong Total

$
0
0

I am trying to get the Net pay on my bi report but it shows 64500.01 as my total netpay instead of 8826.7, I am not sure why this may be happening...I had mentioned all the examples above so didnt know it wasnt viewable. In your example it has an if statement >1000...I am looking for every value out there.  

 

Thank you!

 

 

Capture.PNG

Re: Custom Visual Web Page

$
0
0

Hi ,

Custom visuals are themselves hosted in a iframe. The only sandbox attribute set is allow-scripts, so custom visuals are not very permissive.

In order to embed a web page, you'll need to add an additional iframe element to your visual and then its src attribute would need to be the data-driven URL. You'll therefore need to consider:

  1. Whether your intended URL can be embedded in an iframe to begin with.
    • Some websites or web apps explicitly block this cross-domain (using an X-Frame-Options setting on their side of things). If the web site is hosted or managed by yourself then you can probably manage this appropriately.
    • If this is the case then you won't be able to use a custom visual.
  2. If #1 works, then you will need to see if hosting that iframe in a sandboxed iframe (the custom visual container) still works, as:
    • The sandboxing permissions applied to it may have downstream effects.
    • The sandboxing removes the domain from the custom visual iframe so that it does not belong to powerbi.com.

Without getting into developing custom visuals, you would previously have been able to test this in Power BI using the HTML viewer custom visual, but that seems to have disappeared recently. I know that when people have tried this approach with certain sites, they might work in the Power BI Service (online) but not in Power BI Desktop due to some differences in how they work (this probably has something to do with the service being identified as powerbi.com but Desktop technically not being hosted at a specific loaction on the web... I haven't looked into it in great detail).

However, you could so a simple proof-of-concept test outside of Power BI with a .html file. Something like the following HTML could simulate an iframe being hosted in a custom visual's iframe:

<html><body><!-- Simulating a sandboxed iframe (custom visual) --><iframe sandbox="allow-scripts" height="300" width="300"><!-- Page we want to see --><iframe src="https://www.google.com"></iframe></iframe></body></html>

(note that google.com definitely won't work as they do have the permissions detailed in#1 above set; this is just so that you can see where I'd be coding my intended URL).

Regards,

Daniel

Re: Combine table A with diferent columns

$
0
0

Hi , and welcome aboard 🙂

As a heads-up, you'd be better asking questions like this on in the Desktop forum, as this particular forum is concerned with extending Power BI via code, and we don't get a lot of people hanging out in here. The Desktop forum has a lot more readily available support and youre likely to get much faster assistance.

I'll answer this one for you here though.

If both tables share the same granularity (i.e. one row per product per customer), then you should merge them when getting their data via Power Query into a single table. I've mocked-up your data and attached a workbook for you to have a look at, but I'll do a quick walkthrough:

Source Data

Here are the tables in Power Query:

image.png

image.png

Merging Tables

Select both tables with [Ctrl] + click and choose Merge QueriesMerge Queries as New, e.g.:

image.png

How you proceed next, is down to the data. I'm assuming that reporting events are driven by sales, so Table B is my 'left' table. In this scenario I want to keep all sales data and then find any rows in the Table A that have corresponding discounts. So, I add Table B to the top of the dialog and Table A to the bottom. These tables have ID.CUSTOMER and PRODUCT as common keys so I select them both (note the the order is important), and then select Left Outer as the join kind.

image.png

RADACAD has a great article for further reading on how to understand the table merging concepts further.

Getting Discount

We now have a new query in our list, with a slightly modified layout, e.g.:

image.png

We'll now get the discount, by expanding the Table B column and leaving DISCOUNT selected, e.g.:

image.png

I've also opted not to use the orignal column name as a prefix.

When I click OK, I'll get the column in my query, e.g.:

image.png

So, now my table has my metrics in a common grain.

Tidying Up

Now we've merged our tables, we need to ensure that our previous two tables don't end up in our report, as they are used to build our single reporting table.

In the query editor, right-click on each and untick the Enable load option. This will update the query with an italicised font, indicating that it's for reference only, e.g.:

image.png

Then, I'll just give my Merge1 query a more sensible name, e.g.:

image.png

Just to sanity check my queries, I should see the following in my list:

image.png

Note that Table A and Table B are italicised, meaning that they aren't going to end up in the model, but our Sales table will.

Testing

Now, I can Close & Apply my query and check my report, e.g.:

image.png

And add these to a single table, e.g.:

image.png

Further Reading

Where possible, try to look at your data and model it according to star schema design, as this will make your life much simpler 🙂This article in the Power BI documentation is an excellent place to begin. Become familiar with the terminologies and concepts as these will be highly valuable to you, and not just for Power BI, but BI work in general.

As mentioned above, I've attached the workbook from my example and you should be able to see it below the post.

Good luck!

Daniel

Learning material for custom visual.

$
0
0

Hello, I have created a custom visual and it works! Although I have just been stubling along to get it working, I am firmilular with python, java, a little bit of C# and some other languages. I have got 0 experience with Typescript or javascript/node js. Could someone tell me know what I should be focus on learning to understand the fundamentals of what is going on, for example the svg elements and everything else that goes along with it. Should I be learning javascript, d3, typescript or whatever else?

 

Thank you

Brenton Collins

Re: Learning material for custom visual.

$
0
0

Hi ,

Glad to see you're having success! The biggest challenge w/custom visuals (apart from the sheer patience in developing) is the number of possibilities out there in terms of frameworks and design decisions you can take to achieve the same result, so there's no 100% correct answer.

I come from a mixed background and had some experience with D3 prior to learning custom visuals, so I have naturally tended towards that. Some of the Power BI tools provided by the custom visuals team have a D3-leaning as well, but it ultimately comes down to what your visual is needing to do. For instance, I'm looking at building something right now using React and very little reliance on D3.

Anyway... for me the biggest challenge was taking JS code and applying to TS, as TS is (rightly) much stricter with typing. TBH I'm trying to use TS for most projects now where I would have used JS previously as I like it so much.

In terms of custom visual-specific learning, there isn't much, so for me, upskilling has been a matter of using the following as best I can:

  • Right here in the Power BI community - although there aren't many of us here answering custom visual questions, there are quite a lot of posts dotted about, and one of the ways I learn is to try and find solutions to others' questions.
  • The new MS doc for visuals development (if you haven't seen it) is better than the older stuff but still light on examples. I have made a lot of what's there work though.
  • This YouTube playlist uses and older version of the visuals SDK so some work might be required to port code, but it's an incredible resource if you want to see things working.
  • A lot of authors open-source their visuals and you can use these to see some of the concepts played out. Here's a post with some of the MS ones. Also feel free to have a look through my GitHub repos for anything you might find handy.

I have a blog that I try to contribute some custom visual-specific content to, but most of the time I put most content on posts in this forum. I'm also currently working on a Power BI visuals development course for RADACAD, which is expected to be out... soon. Probably next month if everything lines up properly.

For general web dev and custom visuals, I've found the following essential:

  • TypeScript's reference manual, to understand how the ecosystem hangs together and when to use TS-specifics rather than JS.
  • W3Schools for re-educating me about pretty much anything fundamental WRT web development. Also contains some good guides for common frameworks such as Bootstrap and Angular (which you absolutely can use in custom visuals).
  • Observable (of which Mike Bostock, creator of D3 has a huge hand in) is great for lots of live examples using popular frameworks, and can be used as a jumping-off point for prototyping and finding loads of great modern D3 examples, including tutorials, if D3 is what you're backing.
  • What NPM is and how you should manage your packages. I personally have switched-over to yarn for my bigger projects but was using NPM quite happily for a long time (and still do in some places).
  • If you want to get really into things under the hood, you can have a look into webpack, which is the bundling system used to testing and packaging custom visuals. you can then use the webpack plugin to override the defaults and make even more libraries and frameworks available to your visual.
  • Google and Stack Overflow😛 You can find good quality answers to pretty much any web dev-based question I've ever had.

This is all I have off the top of my head and I hope that you might find some use in it. I'd love to know if anyone else has other resources they've learned from too 🙂

Cheers,

Daniel


DAX Max Consecutive days run in Date Range Selected

$
0
0

HI Guys,

after some DAX help in solving a problem I have.

Basically its a table of dates and results and targets.

 

I need to get the maximum consecutive days that Targets have been met in the selected date range.

 

So looking at the data below.

With the entire set selected (22/5 - 10/6 ) it would be 5 days in a row that they have met targets of 0.75 (Or 75%) and above.

If the date range is altered to be from the 30/5 to 10/6 then it would just 3

and just possibly just 1 if it was from 06/06 to 8/06.

 

I know this is a island and gaps type problem and can solve it in SQL, but in DAX it has really stumped me, even after looking at other examples in the community pages re consecutive days.

 

The 'Result' column is a measure from a calculate but I've put in example below to simplify what Im trying to do.

As you can imagine this is very valuable information to the end user when they work with large date ranges of a year or so.

Also, Im using Direct query.

 

Any help welcomed.

Mike.

 

 

DateResultMet Target 0.75 and aboveTarget Run
22/05/20200.7N0
23/05/20200.72N0
24/05/20200.71N0
25/05/20200.78Y1
26/05/20200.79Y2
27/05/20200.81Y3
28/05/20200.77Y4
29/05/20200.76Y5
30/05/20200.71N0
1/06/20200.72N0
2/06/20200.71N0
3/06/20200.76Y1
4/06/20200.76Y2
5/06/20200.77Y3
6/06/20200.71N0
7/06/20200.72N0
8/06/20200.75Y1
9/06/20200.76Y2
10/06/20200.74N0

 

How to get value for each row in lastnonblank?

$
0
0

When I run the following dax code it returns the lastnonblank of whole column from the table. How can I get the result for each row?

(status can be Active or Inactive)

 

Status = LASTNONBLANK('Production'[Status],1)

 

Re: Remove spikes from data

$
0
0

Thank you  

 

That really helped! I got all the data I needed!

Embedding Reports with Power BI Embedded

$
0
0

Hi everyone! 

 

We have recently added the Power BI Embedded service to our Azure platform and I am trying to figure out how exactly to work with it. 

 

I have created a new App Registration and have give it permissions for the Power BI Service. So I think I have that part out of the way. I am at the stage where I am figuring out how to actually embed the report onto our website. 

 

I have found this link https://www.msbiblog.com/2017/05/13/power-bi-embedded-step-3-integrate-your-report-using-php-and-javascript/ which makes a lot of sense, however there are couple of things I don't understand or know where to get:

  • It is asking to "Fill in the Azure Power BI Workspace Collection Access Key". Where do I get this key? Is this my Application ID? 
  • Then it asks to "Fill in the Azure Power BI Workspace  Collection Name" - again, not sure what that corresponds to? 
  • Fill in the Workspace ID - How can I see the ID of my workspace? 

Everything else is pretty self explanatory. As well as that, is this the correct way to go about using Power BI Embedded with PHP? 

 

Thank you! 

Linking Power BI to external software

$
0
0

Hello,

We are developping a Power BI report of data from a model based in an external software. The software receives excel files as inputs and generates excel files as outputs.

We are looking at the possibility of using a button/controller in the Power BI report that would allow the user to directly run the external model and update the report. Does that sounds like something possible to do in Power BI?

Thank you very much.

Viewing all 48937 articles
Browse latest View live


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