Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I am currently working with a dataset that has group pricing, meaning the customer's individual price is stored, but if they are part of a purchasing group, that price is also stored. I want the group price to take precedence over the individual price. I am struggling to have a way in DAX to create this right anti join to retrieve the group value if and only if the customer is in a group. Below is my current DAX logic and what it returns for visual reference. Thanks.
(Note: Here my desired return would only be the row with Group Flag of "1", not both the customer and group price, but still need to be able to see other parts and customers who may not have a group , so cannot simply filter if it has a groupflag or not)
Below is my attempt in DAX to pull all group values and then individual customer values, while having group take precedence over customer.
Solved! Go to Solution.
What if you filter your table to only return the row for each customer where the GROUPFLAG is minimal? I.e., the group price if it exists, but otherwise the customer price.
FILTER (
'Pricing Query',
'Pricing Query'[GROUPFLAG]
= CALCULATE (
MIN ( 'Pricing Query'[GROUPFLAG] ),
ALLEXCEPT ( 'Pricing Query', 'Pricing Query'[ABAN8] )
)
)
What if you filter your table to only return the row for each customer where the GROUPFLAG is minimal? I.e., the group price if it exists, but otherwise the customer price.
FILTER (
'Pricing Query',
'Pricing Query'[GROUPFLAG]
= CALCULATE (
MIN ( 'Pricing Query'[GROUPFLAG] ),
ALLEXCEPT ( 'Pricing Query', 'Pricing Query'[ABAN8] )
)
)
The above code worked for what I needed it to do, although I changed the MIN funciton to MAX. Thanks!
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 38 | |
| 35 | |
| 25 |