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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
RolinMartis
Helper II
Helper II

Need help in filtering out data in a table based on multiple condition

Hi,

 

I need to create a table which will show data based on month filter selected and also based on another flag.

 

so

  1. wherever Flag = Yes in table it should show me all the records where approved date is <= filter slection
  2. wherever Flag is No then only the rows for that selected month should show up.

 

so say in the snipping i have June month selected, so the table below should show data for all Flag=Yes and Month = April may and june 

But  for Rows with Flag= No, it should show only rows with month = June and not show other months in table.

 

Is this doable?

 

RolinMartis_0-1660914221904.png

 

 

Result

RolinMartis_1-1660914785388.png

 

I am not sure how to attache the dashboard here, otherwise i would have done it

 

Thanks in advance

 

Regards,

Rolin

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@RolinMartis , In this case, the date slicer needs to be on an independent date table

 

then you can measure like

 

//Date1 is independent Date table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = minx(allselected(Date1),Date1[Date])
return if(selectedvalue(flag[flag) = "Yes" ,
calculate( sum(Table[Value]), filter('Table', 'Table'[Date] >=_min && 'Table'[Date] <=_max)),

calculate( sum(Table[Value]), filter('Table','Table'[Date] <=_max)) )

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@RolinMartis , In this case, the date slicer needs to be on an independent date table

 

then you can measure like

 

//Date1 is independent Date table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = minx(allselected(Date1),Date1[Date])
return if(selectedvalue(flag[flag) = "Yes" ,
calculate( sum(Table[Value]), filter('Table', 'Table'[Date] >=_min && 'Table'[Date] <=_max)),

calculate( sum(Table[Value]), filter('Table','Table'[Date] <=_max)) )

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

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

HI @amitchandak 

 

One last question.

 

what should i do if i need to show number of rows in a card instead of table. I added the same measure in card but it gives me less count.

 

below is my formulae

 

Measure 9 = VAR maxdate = MAXX(ALLSELECTED('New Calender table'), 'New Calender table'[Date column])
VAR Mindate = MinX(ALLSELECTED('New Calender table'), 'New Calender table'[Date column])
return

if(selectedvalue('INP 006 Lenovo Incremental HC - Budget'[flag]) = "Yes" ,
CALCULATE(COUNT([BGT Incremental HC List]), filter('INP 006 Lenovo Incremental HC - Budget', [Date column]<=maxdate))
,

calculate( COUNT([BGT Incremental HC List]), filter('INP 006 Lenovo Incremental HC - Budget', [Date column] =maxdate )))
 
Do i have to change the logic to show the count of rows wherever the conditions satisfy
 
Regards,
Rolin

HI @ Amit,

 

Thanks alot for your solution. It worked for me.

 

Just had to change the formulae a bit in else condition instead of <= I had to use = as below and everything worked fine

 

calculate( sum(Table[Value]), filter('Table','Table'[Date] =_max)) )

 

 

)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.