Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I want perform follwing sql query operation in Powerbi using Measure. Also i want to filter result of these query based on date using date slicer
Query 1 :
select distinct( DocNo) from InvoiceHistory where StatusDescription IN ('3-WAY MATCH ERROR')
and statusid = '9e'
and ManualProcessingFlag <> '1' and DocNo Not in
(select distinct(DocNo) from InvoiceHistory where StatusDescription IN ('NEW','SUCCESSFULLY PROCESSED')
))
I have tried following measure to achieve similar result.
Measure = CALCULATE(
DISTINCTCOUNT(InvoiceHistory[DocNo]),
FILTER((InvoiceHistory), [StatusDescription]="3-WAY MATCH ERROR"
&& InvoiceHistory[StatusID]="9e"
&& InvoiceHistory[UpdatedDate] <= max(InvoiceHistory[DocDate])
&&InvoiceHistory[ManualProcessingFlag]<>1
&& NOT( (Invoice[DocNo] in
( CALCULATETABLE
(DISTINCT(Invoice[DocNo]),
FILTER((Invoice),(invoice[StatusDescription]="New" || Invoice [StatusDescription] ="SUCCESSFULLY PROCESSED")
)))))))
Please help.
@Anonymous Please share data in excel using onedrive/google drive to get your answer quickly. Remove any sensitive information before sharing.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 33 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |