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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
wangjuan303
Helper III
Helper III

How to filter data from Dax

I have a report like under the screenshot, ID will have a different status,

Want to create a measure to count ID that not including a "Reject" status record, 

The highlighted column is what I need, but from Dax, I don't know how to add conditions, 

Thank you for your help. 

 

wangjuan303_0-1686370810333.png

 

2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@wangjuan303 

maybe you can try this

 

approve count = 
VAR _reject=countx(FILTER(all('Table'),'Table'[ID]=max('Table'[ID])&&'Table'[status]="reject"),'Table'[ID])
return if(ISBLANK(_reject),1)

1.PNG

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Hi,

This measure works

Measure = COUNTROWS(FILTER(VALUES('Table'[ID]),CALCULATE(COUNTROWS('Table'),'Table'[status]="approve")>=1&&CALCULATE(COUNTROWS('Table'),'Table'[status]="reject")=0))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
ryan_mayu
Super User
Super User

@wangjuan303 

maybe you can try this

 

approve count = 
VAR _reject=countx(FILTER(all('Table'),'Table'[ID]=max('Table'[ID])&&'Table'[status]="reject"),'Table'[ID])
return if(ISBLANK(_reject),1)

1.PNG

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Hi Ryan, Thank you for your help. But I think I give a wrong example, make you misunderstand, I need count of "Approve" status without Reject ID, for example, I need under result, Do you have any idea? Thank you very much 

wangjuan303_0-1686523432967.png

 

@wangjuan303 

pls try this

Measure = DISTINCTCOUNT('Table'[ID])-CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[status]="reject"))

1.PNG

pls see the attachmetn below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you for your quick help, this measure does not work for my scenario, in real data sources, it also exists ID not Reject and also not Approve, for example my screenshot ID 6, I need create measure like under hightlight column, just count ID not exist Reject status and when it is apprve. @ryan_mayu 

wangjuan303_0-1686538043820.png

 

@wangjuan303 

then what about this measure

Measure =CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[status]="approve"))-CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[status]="reject"))




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

This measure works

Measure = COUNTROWS(FILTER(VALUES('Table'[ID]),CALCULATE(COUNTROWS('Table'),'Table'[status]="approve")>=1&&CALCULATE(COUNTROWS('Table'),'Table'[status]="reject")=0))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.