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
powerbi_alvic
Frequent Visitor

DAX Measure with Conditional Filters

Hello guys,
I need help for this requirement.  Number of tickets rejected that have been passed previously(create_time) by commercial queue.

Is it possible to do it with a measure?

 

Captura.PNG

 

 

Please help! Any advice is welcome.

I appreciate your help guys!

Thank you!

1 ACCEPTED SOLUTION

Hi,

 

This should work for you:

 

___CountPassedbyCommercialPrev = 
var _dateRejected = CALCULATE(MAX('Table'[create_time]),'Table'[state]="rejected")
return

COUNTROWS (
    FILTER (
        ALL ( 'Table' ),
        'Table'[ticket_id] = SELECTEDVALUE ( 'Table'[ticket_id]) && 'Table'[queue] = "commercial" && 'Table'[create_time] <= _dateRejected )
    )


___CountPerTicket = 
SUMX(VALUES('Table'[ticket_id]),[___CountPassedbyCommercialPrev])

 

 

Link to the file here

 

In this video I explain how to approach and build such a measure. Hope its helpfull.

 

Kind regards,

 

 

Steve. 

 

 

 

View solution in original post

5 REPLIES 5
felipetrin
Regular Visitor

Hi!

 

Try that: 

Number of Tickets Rejected by Commercial = 
CALCULATE(
     COUNTROWS(Table),
     Table[state] = "rejected",
     Table[queue] = "commercial"
)

Hi,

 

This should work for you:

 

___CountPassedbyCommercialPrev = 
var _dateRejected = CALCULATE(MAX('Table'[create_time]),'Table'[state]="rejected")
return

COUNTROWS (
    FILTER (
        ALL ( 'Table' ),
        'Table'[ticket_id] = SELECTEDVALUE ( 'Table'[ticket_id]) && 'Table'[queue] = "commercial" && 'Table'[create_time] <= _dateRejected )
    )


___CountPerTicket = 
SUMX(VALUES('Table'[ticket_id]),[___CountPassedbyCommercialPrev])

 

 

Link to the file here

 

In this video I explain how to approach and build such a measure. Hope its helpfull.

 

Kind regards,

 

 

Steve. 

 

 

 

Great job, it is great !!!

Grateful for your help.

@powerbi_alvic , Welcome, hope you like the video? Thumbs up on the post(s) if you do 🙂

Thank you very much for answering.

But, the problem is that the conditions are in a different row (state = rejected, queue = commercial)

 

I attach pbix file here

 

https://we.tl/t-57lfjXBWDi 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.