REMOVEFILTER/ALL DAX not working as expected : Power BI : Direct Query - view

There is a scenario were we are using REMOVEFILTER DAX function to remove the effect of few columns on the calculation(measure). What we could observe is, the function is working fine till it has maximum 2 columns included within. If we try to add more columns (3 or more) in REMOVEFILTER, the function does not work as expected.
Note : The dataset is a single table (actually a view which has multiple join conditions). We are using a Direct Query mode.
Current Architecture Limitation : Can not use star schema as a model.
Used ALL also, but still the same effect.
Any help here shall help us greatly.
Best Regards,
Pratik

The problem that you are facing is probably related to Auto Exists. Please read the blog and watch the video shared below:
https://www.sqlbi.com/articles/understanding-dax-auto-exist/
https://www.youtube.com/watch?v=aRntX-HiiN8

Related

How to write linq query with multiple conditions in UiPATH

Before asking the question, I don't speak English very well. We apologize for asking again because it is difficult to understand other similar questions.
Question : I want to use linq query with multiple conditions in UiPATH.
Condition 1 : If there is "A" in row, change it to "Alpha".
Condition 2 : If there is "B" in row, change it to "Beta".
...
Condition n(it may be more than 10) : If there is "O" in row, change it to "Omega".
I used the "find and replace" activity, but the higher the number, the slower the processing. As a solution to this, I learned about linq query, but it is difficult to apply and use the basic example.
please help.. thanks..
Linq is suitable for querying or selecting certain rows based on conditions. It is not suitable for updating the data table as such.
You could use to select all rows with A using below statement and use it in a for loop to update the value from A to Alpha
So there is a couple ways you could do this.
Option 1 -
If it's a DataTable that your using then utilise the 'For Each Row' activity.
Then within the for each.
Use the Assign activity
So this would change the value of that row. So you could add your if statement there.
Option 2 -
Use the Invoke Code Activity - set language to C# (or VB - whichever you prefer)
In the Arguments, put your DataTable you are using.
Then go to Edit Code and Input your Linq Statement there.

Informatica routers

I have two sources A source B
Source A passes through a drug lookup and a router to see if the NDC is present and if not goes to either a present table or a nonpresent table.
Source B does the same but only looks for GCN number if it is present then it goes to a GCN present table or a gcn not present table.
I am currently using in Group filters
ISNULL(NDC_DRUG_CODE_LOOKUP)
NOT ISNULL(NDC_DRUG_CODE_LOOKUP)
ISNULL (GCN_CODE_out_LKP)
NOT ISNULL(GCN_CODE_out_LKP)
the problem is that when the lookup and GCN or NDC code match it's not routing properly
So my question is should I use two different sorters or is there a better way to code this.
Using multiple sorters is not the right option because it reduces the performance. Not sure exactly about your requirement, but I hope below is what you are expecting. Use the condition in router in such a way,
ISNULL(NDC_DRUG_CODE_LOOKUP) AND
NOT ISNULL(NDC_DRUG_CODE_LOOKUP) AND
ISNULL (GCN_CODE_out_LKP) AND
NOT ISNULL(GCN_CODE_out_LKP)
If the condition is not working the issue would be with your lookup. Try creating an output target for each look up and test the scenario.
Try Using Unconnected lookup , Call twice with GCN and NDC , And create four flags in single router and route them as per your requirement ...And one more suggestion if you are using ISNULL in router or any transformation , try to default to some like nvl in oracle, the reason is sometime it takes null both side it does not match..
Hope this helps...

Qlikview: Matching columns of two indirectly link tables does not work

Following is the data model of the dashboard I am facing problem in:
http://blob:http://stackoverflow.com/f3e40cfe-e009-4d03-bcf5-b7b4305c18c4
Now, what i want to achieve is that in Case there is a filed named Manufacturing_Date. And in MWODefetcs there is a field named Defect_Date. What i want is that when ever a record is selected from a table containing cases from Case corresponding records are shown in another table based on the exact match of Manufacturing_Date=Defect_Date.
As simple as it sounds, i can not seem to accomplish it. I have tried the following expressions to no avail:
Count({<[Defect_Date_text]=p([Manu_text]),FaultID=,DEFECT_CODE=>}MFG_BARCODE_NUM)
sum({$<Defect_Date ={"=$(Manufacturing_Date__c)"}>}Defect_Date)
Do the 2 tables need to be directly linked. Is it the intermediary iFaults table that is preventing me to accomplish it?
Please help.
you should use the P() set expression like this:
sum({$<Defect_Date =P(Manufacturing_Date__c) >}Defect_Date)

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.

Linq stored procedure with dynamic results

So I'm extremely new to Linq in .Net 3.5 and have a question. I use to use a custom class that would handle the following results from a store procedure:
Set 1: ID Name Age
Set 2: ID Address City
Set 3: ID Product Price
With my custom class, I would have received back from the database a single DataSet with 3 DataTables inside of it with columns based on what was returned from the DB.
My question is how to I achive this with LINQ? I'm going to need to hit the database 1 time and return multiple sets with different types of data in it.
Also, how would I use LINQ to return a dynamic amount of sets depending on the parameters (could get 1 set back, could get N amount back)?
I've looked at this article, but didn't find anything explaining multiple sets (just a single set that could be dynamic or a single scalar value and a single set).
Any articles/comments will help.
Thanks
I believe this is what you're looking for
Linq to SQL Stored Procedures with Multiple Results - IMultipleResults
I'm not very familiar with LINQ myself but here is MSDN's site on LINQ Samples that might be able to help you out.
EDIT: I apologize, I somehow missed the title where you mentioned you wanted help using LINQ with Stored Procedures, my below answer does not address that at all and unfortunately I haven't had the need to use sprocs with LINQ so I'm unsure if my below answer will help.
LINQ to SQL is able hydrate multiple sets of data into a object graph while hitting the database once. However, I don't think LINQ is going to achieve what you ultimately want -- which as far as I can tell is a completely dynamic set of data that is defined outside of the query itself. Perhaps I am misunderstanding the question, maybe it would help if you provide some sample code that your existing application is using?
Here is a quick example of how I could hydrate a anonymous type with a single database call, maybe it will help:
var query = from p in db.Products
select new
{
Product = p,
NumberOfOrders = p.Orders.Count(),
LastOrderDate = p.Orders.OrderByDescending().Take(1).Select(o => o.OrderDate),
Orders = p.Orders
};

Resources