PowerQuery (in PowerBI) weird caching issue - caching

For the past couple of days, I have been trying to overcome a weird issue within Power Query in Power BI Desktop.
I have two tables, one is called the "Mappings" table, and the purpose of this table is to give me a column called "FMReference" after a bunch of transformations.
Mappings Screenshot
I have my main table called "Entry", which DOESN'T HAVE FMReference, and thus, needs to be merged with the Mappings table. To make the merge simpler, I have created a simple column on both tables named "CombinedForMerge". Entry Screenshot
After the setup for the columns are complete, I proceed to create a Left Outer Merge with the Entry and Mappings tables, using the columns I have just made. Left Outer Merge Screenshot
As you can see on the screenshot, the FMReference column says A4.28, which is what I am expecting on my results. However, once I expand that merge to give me the FMReference, I am getting a different value, A3.2! Wrong Value Screenshot
Power BI clearly cached the wrong value on PowerQuery, as I have filtered the Mappings table to JUST one row, to get JUST the one value. Filtered Mappings Screenshot
I have tried clearing the cache from the Power BI Options, but this didn't change anything.
I've also tried rebuilding the Power BI report from a clean, new PBIX, just copying the transformations up to this point, but I am still getting the same issue.
I've tried copying the results of the Mappings table onto a static table, and used it for the merge instead. This worked, which clearly means it is something to do caching on the data transformations on Power BI.
I've refreshed the Preview, as well as Refreshed ALL a few times, but it still returns the wrong result.
I would appreciate any help at this point, the data is very sensitive so I cannot share a lot, but I am happy to give more details if needed.
Thanks in advance!

I ran into similar inexplicably odd behavior when using fuzzy merge, set for an exact match. I wound up swapping the tables and using a Right Outer merge instead. For some reason, that worked. I have no idea what caused the problem or why the Right Outer merge approach worked though. It was quite odd.
So what I'm saying is: Instead of starting your merge from XXXXEntry and matching to XXXXMappings with a Left Outer merge, you might try starting from XXXXMappings and matching to XXXXEntry with a Right Outer merge.
One way to do that, if you still want the merge in the same place in the same query, is to just edit your existing query's code in the formula bar. To do that, click on the Applied Step that is associated with the merge, most likely called Merged Queries; then in the formula bar, swap the references to the tables and change JoinKind.LeftOuter to JoinKind.RightOuter. (One table reference will likely be the name of the Applied Step before your Merged Queries step, instead of XXXXEntry. For me, in the before and after examples that follow, it was #"Changed Type".)
Before:
= Table.NestedJoin(#"Changed Type", {"CombinedForMerge"}, XXXXMappings, {"CombinedForMerge"}, "Changed Type", JoinKind.LeftOuter)
After:
= Table.NestedJoin(XXXXMappings, {"CombinedForMerge"}, #"Changed Type", {"CombinedForMerge"}, "XXXXMappings", JoinKind.RightOuter)
Good luck.

Related

Add fields and query manually to existing single group layout

I already have a group called G_1 in my report and the entire fieldset required for the report are present in G_1.
Now, I have a new requirement which needs data from different tables and hence I created a new query using "Data wizard" and a group called G_2 was created as well.
I don't want to affect the layout of the existing report(every field is in a single repeat frame) and wanted to add my new fields as well
I added fields and mapped the data, but then I got error saying "field references column below its group frequency"
So I have to bring the column under the existing group G_1 without using report wizard.
Any leads would be of big help!
If I understood what you are saying, that won't work.
If you created a new query, it has its group (G_2) and fields selected within that query have to belong to G_2 group. In Paper Layout, by default, every query has the outer frame (M_2), it contains a repeating frame (R_2) and fields have to be part of those frames.
If you set flex off and confine off (so that you could drag fields here and there, even out of its boundaries (frames) and actually do that - drag a field to, say, R_1 frame (which is part of M_1 which belongs to query 1), you'll get that error.
So, what to do?
If possible, the simplest option would be to adjust query Q_1 and add those new fields in there. If not, you'll have those two queries.
One option is to put query 2 objects (frames, fields) below the ones that belong to query 1 (so that they are unrelated). Another is to stretch query 1 frames "down" and make space for query 2 objects. Then you'd draw a M_2 frame (paint it white so that you can easily see what's going on). Within M_2, draw a repeating frame R_2 and paint it yellow. It has to be contained in M_2. Now, create the first field within the R_2 repeating frame. Check the Object Navigator - everything has to be in its place. If it is not, you'll have to move objects backwards (or forward).
Run the report - if it works OK, fine - go on to the next field, and so forth. Test frequently. Once you're done, make it prettier - move everything to its right place, remove painting and - that's it.
On the other hand: as there's only one frame you currently have (I don't know how many fields there are and how complex the layout is), if you are an unexperienced Reports user, your best option is to delete current layout and let the Wizard do the job. It'll certainly ruin everything you've done so far, but it has its advantages - all objects will be on their proper places. Might be time consuming, but adjusting fields and headings and stuff could be simpler and easier.
Unfortunately, there's no easy way to do it. Takes time to gain experience, but - if you have it - go for it. How will you learn how to do it if you actually don't do it?
Best of luck!

Is it possible to reverse a column transformation in Spotfire, and if not, what are the alternatives?

I've made the mistake of using the 'Calculate and Replace Column' feature to replace the wrong column, and realized after the fact. The column I replaced corresponds to last names and is important. I would like to retrieve this column but maintain my other 15 or so data transformations. Ideally, I would like to remove this transformation, but I've come up empty so far. Here's what I've tried:
I tried adding the 'last name' column again from the same external source, using >Insert >Columns... I also tried renaming this column to avoid the data transformation. Unfortunately, this resulted in an entirely empty column, so it did not successfully match to the table or was affected by the transformation..
I checked the source information, and found exactly the 3-4 lines that I wish were not there. I thought it might be possible to edit this but haven't found a way. This seems like it would be the easiest.
Another idea I had was I could replace the data table with the same source, and repeat all of the transformations from the replace data table dialogue (excluding the bad one). This is my next plan of attack, but I figured I would come on here to see if there's an easier way first.
Thanks in advance!
Good News for YOU!!! #jeremyVollen.
It is possible to 'edit' your transformation per Tibco article 44098.
Resolution: If there are more then one transformations on a data table and you need to edit any of those transformation, follow the steps below:
Go To Edit >> Data Table Properties.
Select the desired data table inside which the transformation has been added and click on Refresh Data > With Prompt.
A new window will pop up which will allow you to make the desired changes in each of the transformations.
unfortunately it is NOT possible to reverse data table transformations.
it IS possible to undo the transformations with Edit>>Undo or CTRL+Z, but that's as far as it goes.
my strategy for dealing with this is (in accordance with your #3) to visit Edit>>Data Table Properties, select the table I'm interested in, select Source Information, then copy the contents of the textarea and paste it into notepad. then, I'll File>>Replace Data Table and start over from the beginning while keeping the notepad open so I don't miss any steps.
I realize it's not ideal, but there is unfortunately not another way.

Not getting the correct totals using Cognos Report Studio. Need to get totals that show up in column

newparts_calc
if (([MonthToDateQuery].[G/L Account] = 4200 and [Query1].[G_L_Group] = 'NEW')) THEN ([Credit Amount]-[Debit Amount]) ELSE (0)
Data Item1
total([newparts_calc])
I need Data Item1 to return newparts_calc values only.
So for example in 1st row Data Item1 should be 8,540.8, but is 34,163.2
Whats wrong? how do i fix?
REVISED QUESTION
I apologize for not making sense on the original question.
I have many of the calc's that im trying to gather and put on a crosstab. I want to see sales by month (row) and part category (column)
[Query2] is the one shown in picture above.
It joins [MonthToDateQuery] AND [Query1]
The join is on 'Invoice' and carnality is 1..1 = 1..1
[MonthToDateQuery] is based on the package im working in. General ledger. It supplies the g/l entries for each sales g/l account
[Query1] is a SQL query i brought in to be able to break out categories even further from g/l group.
For example g/l account 4300 is rebuilt. However i needed to break out even further to see Rebuilt-Production and Rebuilt-New. I can do that with the g/l group.
I saw in my g/l account ledger entries that it referenced the invoice number. So thats how i tied in my SQL.
So as you can see from the table below (which is the view tabular data from query) i need a total. I have tried plugging newparts_calc into my crosstab and setting aggregation to total but the numbers still dont seem right. I dont think i have something set as it should be.
All the calc's im doing are based on single or multiple G/L Accounts and single or multiple G/L Groups.
Any Advice?
As you can see the problem seems to be duplicate invoice numbers.
How can i fix?
Couple things come to mind:
-Set the processing order to 2
-Since your calc is always a multiple and you are joining two queries, you may need to check your cardinality. Sometimes it helps to add derived queries to ensure you are working with the correct grain.
I'm obviously missing something, but if you want
I need Data Item1 to return newparts_calc values only.
just use newparts_calc, without total? That would give you proper value for row 1 -)
If you need a running-total for days (sum of values for previous days) — you should use a running_total function.
At a guess, one of your two queries is returning multiple rows for each invoice, which will cause this double counting. Look at the output of the two queries and see if that's happening. If so, then you just need to work out how to collapse that down to one row per invoice.
Per your new question - The underlying data has got to be causing the issue. Its clearly not 1:1 (note that even though this is what your stated cardinality is, Cognos does not enforce 1:1). Invoice number is not unique, GL Group is at a lower level.

Reporting services - Interactive sort nulls last - Reportviewer VS2010

SSRS 2008
I've defined Interactive sort on a column that has also null values.
I want the nulls to always appear at the end of the report regardless of whether the
direction is Ascending or Descending.
Report is displayed by Reportviewer in VS2010
User clicks on column header to activate interactive sort
All help/suggestions are welcome.
I can think of one workaround here, which may or may not help, but at worst might give you more ideas.
What you can try doing is actually use two tables, and apply the sort to only one, but make it look like one table in the report.
Create two tables:
Apply filters to the tables to show non-null values in the first and null values in the second.
I used the expression:
=IIf(IsNothing(Fields!val2.Value), "NULL", "NOTNULL")
Apply Interactive Sorting to the first table.
This gives the results:
So in this simple case it's achieving what you're after.
Since it's actually two objects, you might get breaks in places users don't expect; this could be mitigated by keeping the objects together with a Rectangle.
If you're looking for multiple columns this might not be suitable, but hopefully it helps.

Filtering Quotes by InventTable

I'm trying to build a report in AX 2009 (SP1, currently rollup 6) with a primary data source of the SalesQuotationLine table. Due to how our inventory is structured, I need to apply a filter that shows only certain categories of items (in this case, non-service items as defined in the InventTable). However, it seems that there is a problem in the link between the SalesQuotationLine and InventTable such that only two specific items will ever display.
We have tested this against the Sales Quotation Details screen as well, with the same results. Executing a query such as this:
...will only show quotes that have one of the specific items mentioned earlier. If we change the Item Type to something else (for example to Item), the result is an empty set. We are also getting this issue on one of our secondary test servers, which for all intents is a fresh install.
There doesn't seem to be any issues with the data mapping from the one table to the other, and we are not experiencing this issue with any other table set. Is this a real issue, or am I just missing something?
After analyzing the results from a SQL Profile run during the execution of the query, it seems the issue was a system bug. When selecting a table to join to the SalesQuotationLines, you have two options: 'Items' and 'Items (Item Number)'. Regardless of which table you select the query executes with, it joins the InventTable with the relation "SalesQuotationLines.ProjTransCode = InventTable.ItemId".
After comparing the table to other layers in the system, I found the following block of code removed from the createLine method (in the SYP layer):
if (this.ProjTransType == QuotationProjTransType::Item)
{
this.ProjTransCode = this.ItemId;
}
Since the ProjTransCode is no longer being populated, the join does not work except on certain quote lines that do have the ProjTransCode populated.
In addition, there is no directly defined relation to the InventTable - the link is only maintained via an Extended Data Type that is used on the SalesQuotationLine.ItemId field. Adding this relation in manually solved the problem.

Resources