Forum Discussion
Need help with TreatAs please
Hi,
I have a salesfact table which shows 'Sold qty' and 'Sold last year'.
No I wanted to add a column called 'Qty on order' with a TREATAS function to get data from the orderfact table.
This is the measure:
and this is the data behinbd the orderfact table:
As we can see above ItemNo 1600 is on order with a quantity of 17.
But this quantity is not presented in the salesfact table (see green rectangle).
The reason is, that ItemNo 1600 was sold only last year.
In year 2022 (which is filtered by the standard PowerBI filters on the right side of PowerBi desktop) ItemNo 1600 was not sold.
So the row for Item1600 is only presented because it was sold last year. This row normally is filtered away by the filter of year = 2022. This seams the reason why the measure for 'Qty on order' is not working.
My question now, is there any way to make tell TREATAS to use the rows presented in the table?
And not the row of my salesfact table (where the row for ItemNo 1600 ist filtered away)?
Or is there any other way to solve this issue?
4 Replies
- amitchandak
Super User
Anonymous , Place of summarize use treatas twice
calculate([Meausre], treatas(<>, <>), treatas(<>, <>))
- AnonymousNot applicable
amitchandak thanks for reply, but sorry I do not understand, could you please explain this in more detail?
- amitchandak
Super User
Anonymous , check if something like this can work
calculate(Sum(OrderFact[Order Qty], treatas(salesfact[Customerno], Orderfact[CustomerNo]), treatas (salesfact[Itemno], Orderfact[Itemno]))