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

PowerBI Dax - Display row based on certain condition

I got two filter (Company Name & Vessel Name) and one table as below; I got three condition to fulfil

 

qpowerbiuser96_0-1641272207453.png

 

First one, if company name and vessel name filter is selected at same time, table will show detail with status FALSE, As example, Jimmy and Ali Anca shown with fail status

qpowerbiuser96_1-1641272257504.png

 

Second condition is, if only vessel filter is selected, table will show detail with only TRUE status. As example, when Ali Anca is selected, table show Ali Anca with TRUE status;

 

qpowerbiuser96_2-1641272295928.png

 

Third condition is, when both filter is not selected, All data will be shown on table with only TRUE status as below;

 

qpowerbiuser96_3-1641272327243.png

Really appreciate if anyone can help

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You will need to create two independent table as below and use these two tables as slicers.

 

Company = DISTINCT('Table'[Company Name])

Vessel = DISTINCT('Table'[Vessel Name])

Then create a measure as below and add it to visual filter set value = 1.

Measure = 
var T_company = SELECTEDVALUE('Table'[Company Name])
var T_vessel = SELECTEDVALUE('Table'[Vessel Name])
var C_company = SELECTEDVALUE(Company[Company Name])
var V_vessel = SELECTEDVALUE(Vessel[Vessel Name])
var T_status = SELECTEDVALUE('Table'[Status])
return
SWITCH(TRUE(),
    ISFILTERED(Company[Company Name])&&ISFILTERED(Vessel[Vessel Name]),
        IF(T_company=C_company&&T_vessel=V_vessel&&T_status="FALSE",1,0),
    NOT(ISFILTERED(Company[Company Name]))&&ISFILTERED(Vessel[Vessel Name]),
        IF(T_vessel=V_vessel&&T_status="TRUE",1,0),
    NOT(ISFILTERED(Company[Company Name]))&&NOT(ISFILTERED(Vessel[Vessel Name])),
        IF(T_status="TRUE",1,0))

1.PNG2.PNG3.PNG

 

Best Regards,

Jay

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

You will need to create two independent table as below and use these two tables as slicers.

 

Company = DISTINCT('Table'[Company Name])

Vessel = DISTINCT('Table'[Vessel Name])

Then create a measure as below and add it to visual filter set value = 1.

Measure = 
var T_company = SELECTEDVALUE('Table'[Company Name])
var T_vessel = SELECTEDVALUE('Table'[Vessel Name])
var C_company = SELECTEDVALUE(Company[Company Name])
var V_vessel = SELECTEDVALUE(Vessel[Vessel Name])
var T_status = SELECTEDVALUE('Table'[Status])
return
SWITCH(TRUE(),
    ISFILTERED(Company[Company Name])&&ISFILTERED(Vessel[Vessel Name]),
        IF(T_company=C_company&&T_vessel=V_vessel&&T_status="FALSE",1,0),
    NOT(ISFILTERED(Company[Company Name]))&&ISFILTERED(Vessel[Vessel Name]),
        IF(T_vessel=V_vessel&&T_status="TRUE",1,0),
    NOT(ISFILTERED(Company[Company Name]))&&NOT(ISFILTERED(Vessel[Vessel Name])),
        IF(T_status="TRUE",1,0))

1.PNG2.PNG3.PNG

 

Best Regards,

Jay

amitchandak
Super User
Super User

@Anonymous ,isfiltered can help

Try a measure like

measure =
Switch( true() ,
isfiltered(Table[Companyname]) && isfiltered(Table[VessalName]) , calculate(countrows(Table) , filter(Table, Table[Status] = FALSE())),
isfiltered(Table[Companyname]) && isfiltered(Table[VessalName]) , calculate(countrows(Table) , filter(Table, Table[Status] = TRUE()))
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Should this measure place on visual filter (table)?

@Anonymous , it can be placed with all un summarized columns, then it will filter data. If there is any other measure you can also use it as a visual level filter

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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