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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
dkalina97
Helper I
Helper I

Show All Lines Using Contains, With a Dynamic Filter

I have found similar issues, but none that seams to match what I am looking for.
I would like to show all items contained on an invoice, where the customer has used a coupon code. We have various coupon codes, each one as a unique Item Number. Currently, I have gotten my measure to work, but only if I specify the Coupon Code in the measure. In the formula below, all items are being show, by invoice (SOP) number, where the coupon used is WEBCOUPON SALE35.

I would like to enable the user to have a filter, which contains the phrase WEBCOUPON. From that filter, the could select which WEBCOUPON(s) they would like to display, and then show all invoices and lines on the invoices.

 

Show Web Coupons =
If(CONTAINS( CALCULATETABLE(
VALUES('Total Combined Sales'[Item Number])
,
ALLEXCEPT('Total Combined Sales','Total Combined Sales'[SOP Number])),
'Total Combined Sales'[Item Number],"WEBCOUPON SALE35"),1,0)
2 REPLIES 2
dkalina97
Helper I
Helper I

This is similar to what I had already written. 
We also have WEBCOUPON SHIP FREE. And WEBCOUPON 25.
I would like the user to be able to select which coupon to view, and then to view all invoices and items on those invoices where that particular coupon code was used.

amitchandak
Super User
Super User

@dkalina97 , You can create a measure like

 


var _cnt = calculate(countrows(filter('Total Combined Sales',containsstring('Total Combined Sales'[Item Number],"WEBCOUPON SALE35") )), ALLEXCEPT('Total Combined Sales','Total Combined Sales'[SOP Number]))
return
calculate(countrows(filter('Total Combined Sales',not(Isblank(_cnt)))))

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
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.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

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.