Quantcast
Channel: All Power Query posts
Viewing all 122396 articles
Browse latest View live

Index column only for specific value (Conditional index column)

$
0
0
Hello,
 
I am looking for some help with the index column. I have a long column (Column1) with text and want add an index column. The challenge is that the index should only be counted (+1) if in Column1 a specific keyword appears. The keyword is always the same. It should look like this:
         
Column1 | Index
-------------------
Keyword | 1
Text 1     | 
Text 2     |
Keyword | 2
Text 3     |
Text 4     |
Text 5     |
Keyword | 3
Text 6     |
....
 
 
I thought of the following steps: filter Column1 for keyword; apply the function "Index Column"; remove the filter. But I don't know how to remove a filter in M Language.
 
Probably my problem is easy to solve but didn't found a solution in other posts. I hope that someone can help here. Thank you. 

Re: Power BI taking ages to apply query changes

$
0
0

it's quite a journey before you Smiley Wink

 

this topic has lots of sources:
https://community.powerbi.com/t5/Desktop/Good-Source-to-Learn-DAX/m-p/537748

 

here is an example for the cumulative totals:

https://www.daxpatterns.com/cumulative-total/

 

regarding your particular model it would be better to revisit once you learn the basic concepts, especially if you come from SQL background - DAX has very different way of solving same problems

if you're under time pressure though here are few tips:

1) instead of quarters as text I'd use dates (e.g. 2019-01-01 for 2019Q1, 2019-04-01 for 2019Q2). This enables using more operators, as well as gives access to the time intelligence functions

2) build a separate Calendar (date dimension) table (for the benefit of time intelligence):

https://www.sqlbi.com/articles/automatic-time-intelligence-in-power-bi/

https://docs.microsoft.com/en-us/power-bi/desktop-date-tables

3) if the baseline scenario is just prior year figures you could calculate these values based on Actual & Calendar table (e.g. using SAMEPERIODLASTYEAR)
https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

Re: Trying to extract files from ZIP

$
0
0

Hello, I am having the same issue using the same MarkWhite function, with the exceptions of xlsx files.   Once I get past this hurdle, each file within the zip file has same name, and then each file has 4 unique tab names.   Will I be able to filter and extract same as a single file?  Appreciate advice and a solution.  Thanks!

Re: Last n days regardless of year

$
0
0

Hi ,

aha, I think I've understand you wrong.

Do you want to have something like requesting all birthdays in the last 7 days? So you don't care about the year part of the date?

Example:

IsInTheLast7Days(11.07.2019) = YES

IsInTheLast7Days(10.07.2018) = YES

IsInTheLast7Days(01.07.2019) = NO

Re: Faster append query

$
0
0

If I do this, it will make working on this much easier for me, but I don't think that I can deliver a tool to my coworkers that takes 45 min to load the first time that they use it or change the parameters of filter in the Excel sheet (the information in those querries is liable to change somewhat regularly so they will need to be updated).

 

What I think I need is some way to tell which steps are running client side. I know of the trick where you right click on the step in the query and see if the "view native query" is greyed out or not, but unfortunately I don't think that it will work for me 100% of the time.

 

I have a step in several queries where I group by and then use a function like  "List.Mode" or "List.StandardDeviation" which are functions that aren't supported in the User Interface. These steps are always greyed out when I try to "View Native Code" and I think the reason is that the UI doesn't support those functions.

 

Is there any way to get a report of how much time each query takes to load? So for example, I could hit "refresh all" before I leave for the evening and return the next morning to see which subqueries needed how much time to refresh? Is there a way to break down that information into the steps within each subquery?

 

I don't think that your solution is a silver bullet, but thanks very much Maggie.

 

Best wishes,

MannyZ



 

Re: Nested table issue with TransformColumns

$
0
0

Hi ,

are you sure, that this property with value2 is correct? The prop1, prop2, and prop3 have just one text value for value2, but in prop4 it is an object. And that is also the problem why the xml file isn't parsed.

<property><name>prop4</name><subprop><value1>400</value1><value2><value3>ooo1</value3><value4>ooo2</value4></value2></subprop></property>

Using SAP BW OLEDB provider

$
0
0

Hi everybody!
I have an Excel file (32 bit)  connected to the SAP BW instance via SAP BW OLE DB Provider.
I'm trying to establish the same connection in PBI Desktop (on the same PC), using the same connetion string (Provider=MDrmSap.2;Data Source=TNP;Location="";Mode=Read;Extended Properties="SFC_CLIENT=100;";Initial Catalog=Z05M04;MDX Compatibility=1).
But in PBI Desktopx64 I have a message that "Provider MDrmSAP.2 does not registerid on this PC"
And in PBI Desktopx32 - "OleDb.DataSource does not currently support multidimensional data sources"

Any Ideas?

Thank you in advance!

Re: Index column only for specific value (Conditional index column)

$
0
0

Hi ,

I have a solution for you. Click through the steps and you will see how it works.

I create an index on the original table. Then I create a second table "KeywordRowFullIndex" which contains only "Keyword" rows and create a secondary index on this smaller table. And in the end I join them together on the FullIndex.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8k6tLM8vSlGK1YlWCkmtKFEwVACBGgWEiBFEBCyAodwYSRIsYIIuYIpPuxlMMhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    IndexColumn = Table.AddIndexColumn(Source, "FullIndex", 0, 1),
    KeywordRowFullIndex = Table.SelectRows(IndexColumn, each [Column1] = "Keyword"),
    SecondaryIndex = Table.AddIndexColumn(KeywordRowFullIndex, "Index", 1, 1),
    Join = Table.NestedJoin(IndexColumn, "FullIndex", SecondaryIndex, "FullIndex", "SecondaryIndex"),
    ExpandedSecondaryIndex = Table.ExpandTableColumn(Join, "SecondaryIndex", {"Index"}, {"Index"}),
    RemoveFullIndexColumn = Table.RemoveColumns(ExpandedSecondaryIndex,{"FullIndex"})
in
    RemoveFullIndexColumn

Re: Is it possible to have an If function in another If function

Re: Index column only for specific value (Conditional index column)

$
0
0

Hi Nolock,

 

Thank you very much for your code, which also provides the index in those rows with the keyword. But unfortunately a lot of rows are deleted in the end, almost every second. Do you have any idea why that is?

Google Analytics Error 403 (failed reporting requests is too high)

$
0
0

Beginning at 11:13 today a report that has uses Google Analytics connector began throwing this error:

 

Updating workbook ... .pbix failed. Please check additional messages in task history for detailed errors. Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: GoogleAnalytics: Request failed (403): Quota Error: Number of recent failed reporting API requests is too high, please implement exponential back off.

See developer documentation for details at  https://goo.gl/NIdnFC.

 

It has run for almost a year, without an issue.  Is anyone else experiencing this?  Has something changed?  I found older issues discussing this, but nothing today.

 

Any insights would be appreciated.

Need to substract production of a same product at different dates

$
0
0

Hi, I need to substract the inital production and the final production of one product at different years,

For example for the product AK01 need to substract the production (WOPT) at the last date of 2019 - the production (WOPT) at the fist date of 2019, the I have to do the same for 2020, 2021 2022 ... The table has other products and I have to do the same thing for each product

 

Diferencial pozos pregunta.PNG

How to Fix Data Does not Line up with Header

$
0
0

When I export a flat data file to Excel, the headers in Excel are shifted exactly one column to the right of the from the underlying data in the columns. Here is a clip of the export file with some arrows showing the malignment:

Annotation 2019-07-12 153339.jpg

 

Is there a transformation/process that can be used on a single row to push the headers over the right columns of data or is this a lost cause? There is so much else wrong with the file but I can fix those issues.

 

Please help, Almighty Datanaught Community!

Re: How to Fix Data Does not Line up with Header

$
0
0

Renaming your columns like so shoud do the job:

 

= Table.RenameColumns(Source, List.Select(List.Zip({Table.ColumnNames(Source), {""} & Table.ColumnNames(Source)}), each _{0} <> null))

Just replace "Source" by a reference to your table if needed.

Re: Index column only for specific value (Conditional index column)

$
0
0

Hi ,

no spontanious idea. Please, can you provide some sample data where it doesn't work?


Re: Nested table issue with TransformColumns

$
0
0

Hi  ,

 

maybe I was wrong with the example.

 

this is how it looks like:

 

power_q_screenshot

 

and expected transformation: name1=value1;name2=value2;name3=value3;......

 

Thank you for your help,

Best regards,

Zefi

 

 

Re: Finding First Name or Last name using DAX like @Username

Re: What is the best way to apply Nested Relationship same as SQL Statements?

$
0
0

I assume that the table you attached is what you want your visual look like, correct?

Do you need to prepare such table for single customer (1067) or multiple customers?

 

I'd start with the following:
1) put Carriers[Name] in the rows of the table visual

2) create first measure - Bookings

Bookings = COUNTROWS('TplBookings')

and put in the visual from 2)

You should now see all the carriers and number of rows from the TplBookings that is related to them

 

now if you want to limit it to a single customer you can either filter in the visual by the customer name (e.g. by using slicer) or hardcode it in CALCULATE (in this case you need single measure for each customer if you need to show more, in that case it's better to use the slicer)

Bookings = CALCULATE( COUNTROWS('TplBookings'), 'Invoices'[CustomerID] = 1067)

 3) continue with the other measures using DAX

Re: Pseudo code

$
0
0

that's not really how PowerBi works

what's your input, and what's your intended output?

 

please post it as tables, following the instructions here:

 

Query Editor - Using query to form other data sets

$
0
0
Hi, I’ve appended A to B, cleaned and transformed the data. Let’s call this table C. I am using C on one page. I do, however, need to use C to make two data set (D) and (E) for use on another page. Can I do this? It’s like taking the pivoted results of C to make D and E.

How can I use C to make D and E? Many thanks!


Sincerely,
Patrick
Viewing all 122396 articles
Browse latest View live


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