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.
I have 2 tables.
Vendor Name | Total Value |
ABC | 10000 |
XYZ | 20000 |
ABCD | 50000 |
T2-Vendor | From Value | To Value | Percentage |
ABC | 0 | 5000 | 5% |
ABC | 5001 | 10000 | 10% |
ABC | 10001 | 100000 | 20% |
XYZ | 0 | 5000 | 5% |
XYZ | 5001 | 10000 | 10% |
XYZ | 10001 | 100000 | 20% |
ABCD | 0 | 100000 | 15% |
I need to Look Vendor name from Table 1 to Table 2. Once I find the value, See if the Total Value from Table 1 falls in to which range to get the Percentage Value. Store the Pecentage value on the Table 1 as column against each row.
Need DAX formula for column creation.
Final Results (Table 1, after adding colum pecentage)
Vendor Name | Total Value | Percentage | Discount |
ABC | 10000 | 10% | 1000 |
XYZ | 20000 | 20% | 4000 |
ABCD | 50000 | 15% | 7500 |
Appreciate your help.
Solved! Go to Solution.
Hi @komaragiri create two columns in vendor table as
Proud to be a Super User!
@komaragiri You can build a relationship between 2 tables assuming the Table1 won't have duplicates in future.
In Table1 you can create a the column using:
Discount =
VAR T1_TotalValue = Table1[Total Value]
VAR T2_SameRows =
CALCULATETABLE (
Table2,
T1_TotalValue >= Table2[From Value]
&& T1_TotalValue <= Table2[To Value]
)
VAR Result =
SUMX ( T2_SameRows, Table2[Percentage] * T1_TotalValue )
RETURN
Result
You can also create the column in Table2 using:
Discount =
VAR T1_TotalValue =
RELATED ( Table1[Total Value] )
VAR ValueInRange =
T1_TotalValue >= Table2[From Value]
&& T1_TotalValue <= Table2[To Value]
VAR Result =
( Table2[Percentage] * T1_TotalValue ) * ( ValueInRange * 1 )
RETURN
Result
thank you for your solutions
@komaragiri You can build a relationship between 2 tables assuming the Table1 won't have duplicates in future.
In Table1 you can create a the column using:
Discount =
VAR T1_TotalValue = Table1[Total Value]
VAR T2_SameRows =
CALCULATETABLE (
Table2,
T1_TotalValue >= Table2[From Value]
&& T1_TotalValue <= Table2[To Value]
)
VAR Result =
SUMX ( T2_SameRows, Table2[Percentage] * T1_TotalValue )
RETURN
Result
You can also create the column in Table2 using:
Discount =
VAR T1_TotalValue =
RELATED ( Table1[Total Value] )
VAR ValueInRange =
T1_TotalValue >= Table2[From Value]
&& T1_TotalValue <= Table2[To Value]
VAR Result =
( Table2[Percentage] * T1_TotalValue ) * ( ValueInRange * 1 )
RETURN
Result
Hi @komaragiri create two columns in vendor table as
Proud to be a Super User!
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 |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |