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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 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.