Format the M language in Power Bi Query - format

Do anyone know how to format the Power Bi back-end query, I did not find any thing only.
Like for JSON we have json formater online.
Can not we do the same, for DAX and M- Language wanted to format the query so that i can read properly.

There is https://powerqueryformatter.com/ - it is helping me format Power Query M language

For DAX, you can use https://www.daxformatter.com/ - provided by the SQLBI team.

Until now, i was able to see few option in Power BI advance editor, that is helping me a bit not 100% formatted code.
Best suggestion would be is to use text editor like sublime and do format your query on building stage, that would give you more clarification if you are working on the Power Bi side. Thanks you.
If someone knows, how to do this query format start to end the whole query, please let me know.

Related

Replicate "Countif" in PowerBI using DAX

I am a new user to DAX and Power BI, but I am familiar with Excel. I want to replicate these countif formulas in DAX. In Excel, they are counting how many times a specific text string (in this case, the name of a brand) appears in the column, for example:
=COUNTIF(BH2:BH31,"Brand_A"), it is counting how many times the text "Brand_A" appears in the selection.
and I would like to know how I can do this in DAX in PowerBI. If anyone would be interested in providing some sample code I could try out, that would be very helpful.
You will likely want something like the COUNTX or COUNTAX function, combined with a FILTER, to replicate the functionality of Excel's COUNTIF.
https://learn.microsoft.com/en-us/dax/countax-function-dax
https://learn.microsoft.com/en-us/dax/countx-function-dax
Eg.
=COUNTAX(FILTER('YourTable',[BrandColumn]="Brand_A"),[BrandColumn])
Power BI's different "COUNT" functions have slightly different criteria in terms of whether a row gets counted or not (based on whether it's considering purely "empty" cells, or how the expression is evaluated), so you'd need to check the docs for each function and work out which one suits your specific requirement
(And by the way, a Google search of "Power BI COUNTIF" will give you plenty of results where you will find a range of different examples that should help)
You can use this calculation (COUNTX may be slow, because its a iterator) :
CountIf = CALCULATE( COUNTROWS('YourTable' ), FILTER(ALL('YourTable'), 'YourTable'[Brand] = "YourBrand"))

Interactive Grid- Automatic Row Processing (DML) : Character limitation in Code editor

I have a requirement where 300 columns had to be processed. I am trying to achieve this using IG automatic row processing (DML). When writing the code in the editor I get a error stating 'Value too long by 2015 characters'.
I suppose this is an Oracle Apex limitation. Can someone please share their views on this?
When writing the code in the editor ...
I'd say that your problem isn't related to number of columns, but a large query which can't fit into "SQL Query" item of the Page Designer.
Which Apex version do you use? I can't tell for sure (as I don't know it), but my impression is that Apex up to version 4.2 had that item limited to VARCHAR2(4000) so - if your query is larger than that, it won't fit (such as in your case - query you wrote is 2015 characters longer than the maximum size the item allows). In 5.x version, you can put a whole lot of query into the item (as if it was modified to a CLOB).
Now, as you use Interactive Grid and it appeared in 5.x version, huh ... maybe what I wrote above isn't entirely true. Unfortunately, you can't switch to a query whose source is a function that returns query (such as in Classic Reports), as you could write a (stored) function and simply call it from Apex.
As you said that you used automatic row processing, did you put too much code somewhere in there?
On the other hand, I Googled a little bit, looking for limit of column numbers in the IG - couldn't find anything official, but someone complained (here, on StackOveflow) that they tried to create an IG with over 100 columns, and it didn't work.
So, yes - maybe you hit the limit, but I can't confirm it. Hopefully, someone who knows Apex better will be able to assist. Alternatively, consider asking the same question on OTN forums, as people who designed Apex answer questions there.

Power BI with date/time format

I am very to the Power BI and I am learning it by myself. I have just sign up free power BI account. For learning purpose I took data of "Case Data
from San Francisco" I exported those data in xlxs format and imported into the Power BI.As per the suggestion of Power BI, I just defined the Excel data to table by pressing
ctrl + T.Now the problem likeI cannot make any chart by status (i.e. open or close)I cannot make any chart by date on the basis of close date or open dateMany more things. Now my question is do I am missing something? Do I have do something with excel file before importing it?Sorry I am asking lot of questions. I am just new learner.
There are plenty of resources for getting you starte. Here's a good starting point:
https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-getting-started/

What is summation for current group in rtf template?

I developed a oracle 10g BI Publisher report and having one issue. I am trying to sum value by current group but I am not getting correct results. Please help me.
<?sum(current-group()/DR[.!=''])?>
Ex: I have <?sum(current-group()/DR[.!=''])?> value is 19,234,770,654,698.34. I had sum with calculator each amount in this group is not equal to above result. Manual summation result is 19,234,770,654,698.33.
Although it is quite late, but hope you will find this answer useful as It worked for me. Replace TAN_AMT with your column name and place that in the appropriate place.
<?sum(current-group()/TAX_AMT)?> - <?sum(current-group()/TOTAL_AMT)?>

How to filter a query result?

Currently I can not quickly filter the result of a work-item query - running a query will give us a result table and within this table, there's no mean to filter the table rows to display just the ones containing some certain text.
Do you know how to filter that or have any addons/tools suggestion for that?
Thank you.
Nam.
You could use
Telerik's free Work Item Manager . It lets you search the text of work items as well as other useful filtering and grouping tools. Very useful.
We use Excel integration pretty heavily in our shop. The familiar sort and filter controls work well.
Not sure if this is what you are looking for:
You can "Edit Query" from the toolbox and save it as a new query.
After a while (long :) ), I luckily notice that there's a filter box if we browse the work items in the pending changes pane (open in VS 2010: View - Other Windows - Pending Changes). It's so nice that now I can quickly get the exact items I'm looking for.
Today, I found an addon that may fit my need: Search Work Items for TFS 2010
It is a search box, not exactly the filter for the current query.
(similar problem with this question)
I re-post the answer here:
After a long time, today I found the solution for this: use the MS VS 2010 Team Web Access to open your queries using a web browser!
Advantage when doing this:
No delay when clicking an item
Utilize all browser feature like searching, bookmark, ... to work with the queries
Enjoy!

Resources