Forum Discussion
TREATAS with 2 conditions same table
- 4 years ago
Hi,
The problem is in your time group columns. The values in the two tables don't match.
In Sales you have values:
Whereas in Budget you have:
So when treatas brings the filter over from Sales to budget nothing matches and you get a blank result.
TREATAS is for taking a filter from one table and applying it to columns in another, unrelated table. Here's an article from Radacad that seems to cover what you intend to do (it's about halfway down the page).
Hope this helps!
Hi littlemojopuppy
Thank you for your answer.
What i didn't understand is what we connect virtualy to. You know? For me i thought it would be sales with budget. But that measure didn't work and only by changing the order it ....almost worked
TBudget2 =
CALCULATE (
[NEW Budget],
TREATAS (
SELECTCOLUMNS (
'Tab Budget',
"Family", 'Tab Budget'[Family],
"Time Group", 'Tab Budget'[Time Group]),
'Tab Sales'[Family],
'Tab Sales'[Time Group])
)
I said almost because now i see the values but it doesn't "relate" with Time Group as you can see:
The numbers are right at the total but not on detail. And this is exactly what Reza did.
Any ideas?
- bcdobbs4 years ago
Community Champion
I think until we can see some more information as littlemojopuppy has suggested it's almost impossible to help. Can you at least send an image of your data model?
I created a simple mock up with the code you've sent so far and the only way I could recreate your blanks was by spelling values in Time Group and Family differently in the Sales and budget tables. Are you sure they're identical? (Run a clean/trim on them in power query).
Your last post with the SELECTCOLUMNS just suggests something odd is going on somewhere in your setup.