Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
71 | |
37 | |
31 | |
27 |
User | Count |
---|---|
91 | |
49 | |
45 | |
38 | |
36 |