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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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