The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have 3 Tables, My target is to create a special discount measure/column.
When the Billing Doc no. have the material which have the [netcase] greater than the scalavalue, then give the corresponding discount([amount]), only counting the larger scalevalue as may fulfill more than 2 discount. I am in trouble because the Material Group is not unique, the same GroupMaterial can have more than 1 Special Material and not sure how to select the larger scalevalue one only
I have try below but not work:
Table1(the Material Group is not unique, the same GroupMaterial can have more than 1 Special Material.
SpecialMaterial GroupMaterial
MO202409-2 | 1010771 |
MO202409-3 | 1010771 |
MO202409-5 | 1010772 |
MO202409-6 | 1010773 |
Table 2:
SpecialMaterialGroupAmountScale
MO202409-3 | 8 | 3.00 |
MO202409-1 | 10 | 3.00 |
MO202409-2 | 10 | 3.00 |
MO202409-3 | 9 | 2.00 |
MO202409-1 | 10 | 24.00 |
MO202409-1 | 8 | 2.00 |
MO202409-1 | 14.5 | 3.00 |
MO202409-2 | 10.7 | 2.00 |
MO202409-4 | 5.5 | 3.00 |
MO202409-5 | 8.6 | 8.00 |
Hi @eunji888888
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Hi @eunji888888
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @eunji888888
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @eunji888888,
Please try below measure:
Special Discount Measure =
VAR BillingDocMaterials =
VALUES('By SO'[Material]) -- Get all materials in the billing document
VAR DiscountTable =
ADDCOLUMNS(
FILTER(
'Combined Group Discount',
'Combined Group Discount'[ScaleValue] <=
MAXX(
FILTER(
'By SO',
'By SO'[Material] = 'Combined Group Discount'[Material Group.Material]
),
'By SO'[NetCase]
)
),
"MaxScaleValue",
MAXX(
FILTER(
'Combined Group Discount',
'Combined Group Discount'[Material Group.Material] = EARLIER('Combined Group Discount'[Material Group.Material])
),
'Combined Group Discount'[ScaleValue]
)
)
VAR MaxDiscountTable =
FILTER(DiscountTable, 'Combined Group Discount'[ScaleValue] = [MaxScaleValue])
RETURN
SUMX(MaxDiscountTable, 'Combined Group Discount'[Amount])