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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors