Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello, I am trying to create a column that expresses whether something is a discount or not based on criteria within a table.
Below is the data set:
| BookingID | ExtraItemQty | ExtraItemExtendedCost |
| 25220696 | 12 | 900 |
| 25220883 | 7 | 525 |
| 25220692 | 4 | 300 |
| 25220876 | 24 | 1800 |
| 25220696 | 12 | -180 |
| 25220876 | 24 | -360 |
| 25220693 | 2 | 150 |
| 25220889 | 2 | 150 |
| 25220885 | 2 | 150 |
| 25220701 | 2 | 150 |
My desired output is as follows:
| BookingID | ExtraItemQty | ExtraItemExtendedCost | Type |
| 25220696 | 12 | 900 | Discount |
| 25220883 | 7 | 525 | Full Price |
| 25220692 | 4 | 300 | Full Price |
| 25220876 | 24 | 1800 | Discount |
| 25220696 | 12 | -180 | Discount |
| 25220876 | 24 | -360 | Discount |
| 25220693 | 2 | 150 | Full Price |
| 25220889 | 2 | 150 | Full Price |
| 25220885 | 2 | 150 | Full Price |
| 25220701 | 2 | 150 | Full Price |
So any ID with a negative ExtraItemExtendedCost would be considered a discount, and if there is not negative value for the ID at some point it is considered Full Price.
Thank you
Solved! Go to Solution.
New column =
var _cnt = countx(filter(Table, Table[BookingID] = earlier([BookingID]) && [ExtraItemExtendedCost] <0), [BookingID] )
return
If(isblank(_cnt) , "Full Price", "Discount")
New column =
var _cnt = countx(filter(Table, Table[BookingID] = earlier([BookingID]) && [ExtraItemExtendedCost] <0), [BookingID] )
return
If(isblank(_cnt) , "Full Price", "Discount")
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 37 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 69 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |