The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have a problem in DAX and can not find a solution after days of searching. Perhaps someone can give me a hint?
I have the current MEASURE Definition:
CostUSER =
VAR currentuser = [SELECTUSER] -- comes from other measure
VAR varD =
SUMMARIZE (
FILTER(USERDepartment,USERDepartment[USERID]=currentuser),
USERDepartment[Department] )
)
VAR calcCost = sumx(FILTER(RegionCost,related(DepartmentRegion[Department]) IN varD),RegionCost[Cost])
RETURN IF(ISBLANK(varD),BLANK(),calcCost)
How it possible to FILTER related(DepartmentRegion[Department]) with two Values ?
The user in USERDepartment can be assigned two 2 Departments. If a choose with a slicer one department everything works but with two Departments it says that one value instead of two was expected.
I try different things like TREATES, but with no success.
The Tables
One hint we be so great! Thank you! 🙂
Solved! Go to Solution.
ISBLANK(<value>) Parameters should be value , can't be a table. You can change this function to COUNTROWS.
ISBLANK(<value>) Parameters should be value , can't be a table. You can change this function to COUNTROWS.
In this case how I can filter if I have not 1 value but 2 values in the column?
But if i choose User 1 I will have two values in varD and get a error.
VAR calcCost = sumx(FILTER(RegionCost,related(DepartmentRegion[Department]) IN varD),RegionCost[Cost])
How i can FIlter if varD has two values ?
It is so wired. But for me it works. VarD is a table with multi values,if you select Userid 1. Calccost DAX function is correct.
Simulate your data
Thank you, Thank you!
Hi, @Anonymous
Have you tried changing the one-to-many single-directional relationships to bidirectional relationships?
Best Regards,
Community Support Team _ Eason
I am not sure, how this can help me in this case. I want to use the measure and do not know how to modify it.
User | Count |
---|---|
27 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
7 | |
6 |