Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Filter with two Values

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. 

andhiii0798_0-1663167043049.png

 

The Tables

andhiii0798_3-1663167304322.png

 

andhiii0798_2-1663167288330.png

andhiii0798_4-1663167335776.png

andhiii0798_5-1663167351892.png

 

One hint we be so great! Thank you! 🙂

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

ISBLANK(<value>)  Parameters should be value , can't be a table. You can change this function to COUNTROWS. 

IF(COUNTROWS(varD)=0,BLANK(),calccost)

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

ISBLANK(<value>)  Parameters should be value , can't be a table. You can change this function to COUNTROWS. 

IF(COUNTROWS(varD)=0,BLANK(),calccost)
Anonymous
Not applicable

In this case how I can filter if I have not 1 value but 2 values in the column? 

Anonymous
Not applicable

  • Actually your DAX formular can filter multi values except isblank function is wrong. You can change it and test.
Anonymous
Not applicable

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 ? 

Anonymous
Not applicable

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. 

Anonymous
Not applicable

Simulate your data

 

Youngli_0-1663723212407.png

 

Youngli_1-1663723249175.png

 

Anonymous
Not applicable

Thank you, Thank you! 

VAR calcCost = sumx(FILTER(RegionCost,related(DepartmentRegion[Department]) IN varD),RegionCost[Cost])
RETURNIF(COUNTROWS(varD)=0,BLANK(),calcCost)

I do not realize, that ISBLANK is the error. Now it works with countrows! 🙂
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Have you tried changing the one-to-many single-directional relationships  to bidirectional relationships?

 

Best Regards,
Community Support Team _ Eason

Anonymous
Not applicable

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. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.