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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

subtraction between the two date with filters

HELLO, HELP ME PLEASE! I have a table and I would like to do the subtraction between the two rows of dates that I have selected (in gray). But I would have to take the first date with the status "NEW" and the first date with and status "FEASIBILITY ERROR" and make the difference.I want to filter only on messages that contain "322".  and finally I would like to do this with client 1 / Value 1, client 1 / Value 2 etc, Client 2 / value 1, 2,3 etc.

Thank's a lot for your help.

 

test.PNG

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

Measure =
VAR __id = MAX ('Table'[compte] )
VAR __date1 = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[compte] = __id && 'Table'[Status] = "NEW" && search("322",'Table'[message],,0)>0)
VAR __date2 = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[compte] = __id && 'Table'[Status] = "FEASIBILITY ERROR" && search("322",'Table'[message],,0)>0)
return
datediff( CALCULATE ( min ('Table'[Date] ), VALUES ('Table'[compte] ),'Table'[compte] = __id,'Table'[Date] >= __date1 && 'Table'[Status] = "NEW" && search("322",'Table'[message],,0)>0 ) , CALCULATE ( min ('Table'[Date] ), VALUES ('Table'[compte] ),'Table'[compte] = __id,'Table'[Date] >= __date2 && 'Table'[Status] = "FEASIBILITY ERROR" && search("322",'Table'[message],,0)>0),day)

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.