Forum Discussion
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
- wherever Flag = Yes in table it should show me all the records where approved date is <= filter slection
- 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?
Result
I am not sure how to attache the dashboard here, otherwise i would have done it
Thanks in advance
Regards,
Rolin
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
3 Replies
- amitchandak
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
- RolinMartis
Helper II
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)) )
) - RolinMartis
Helper II
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])returnif(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 satisfyRegards,Rolin