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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi everyone, I originally needed this code below (coupon or deal format) to apply conditional formatting when an item was on a deal/coupon depending on the date. However, I now need to modify this formula, with the same filters, to become a slicer based on yesterday's deals/coupons. The end goal is to create a metric that I can slice by coupon, deal, prime exclusive deal, lightning deal, etc. Thanks for your help!
Coupon or Deal Format =
VAR tempTable =
FILTER (
'Deals and Coupons',
'Deals and Coupons'[Coupon Start Date] <= SELECTEDVALUE ( 'Calendar'[Date] )
&& 'Deals and Coupons'[Coupon End Date] >= 'Deals and Coupons'[Coupon End Date]
&& 'Deals and Coupons'[Deal Start Date] <= SELECTEDVALUE ( 'Calendar'[Date] )
&& 'Deals and Coupons'[Deal End Date] >= 'Deals and Coupons'[Deal End Date]
&& 'Deals and Coupons'[Prime Exclusive Discount Start Date] <= SELECTEDVALUE ( 'Calendar'[Date] )
&& 'Deals and Coupons'[Prime Exclusive Discount End Date] >= 'Deals and Coupons'[Prime Exclusive Discount End Date]
)
VAR MINIMUMDATE =
MINX ( tempTable, 'Deals and Coupons'[Coupon Start Date] )
VAR MAXIMUMDATE =
MAXX ( tempTable, 'Deals and Coupons'[Coupon End Date] )
VAR MINIMUMDATE2 =
MINX ( tempTable, 'Deals and Coupons'[Deal Start Date] )
VAR MAXIMUMDATE2 =
MAXX ( tempTable, 'Deals and Coupons'[Deal End Date] )
VAR MINIMUMDATE3 =
MINX ( tempTable, 'Deals and Coupons'[Prime Exclusive Discount Start Date] )
VAR MAXIMUMDATE3 =
MAXX ( tempTable, 'Deals and Coupons'[Prime Exclusive Discount End Date] )
VAR DATE2 =
MAXX ( tempTable, 'Deals and Coupons'[Lightning Deal Date] )
RETURN
IF (
AND (
SELECTEDVALUE ( 'Calendar'[Date] ) >= MINIMUMDATE,
SELECTEDVALUE ( 'Calendar'[Date] ) <= MAXIMUMDATE
),
"#A9F099",
IF (
AND (
SELECTEDVALUE ( 'Calendar'[Date] ) >= MINIMUMDATE2,
SELECTEDVALUE ( 'Calendar'[Date] ) <= MAXIMUMDATE2
),
"#97E6F8",
IF (
AND (
SELECTEDVALUE ( 'Calendar'[Date] ) >= MINIMUMDATE3,
SELECTEDVALUE ( 'Calendar'[Date] ) <= MAXIMUMDATE3
),
"#E6A1CB",
IF (
SELECTEDVALUE ( 'Calendar'[Date] ) = DATE2,
"#D1CEFF"
))))
Hi grbs,
Please explain more on what you want to achive with few more data, you can use the code you have posted only when you know where to plugin what
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 67 | |
| 59 | |
| 45 | |
| 19 | |
| 15 |