Forum Discussion
RelationShips an calculate column
I HAVE TWO TABLES ONE FOR SALE AND OTHER TAXES.
I NEED TO CALCULATE THE
"FINAL UNIT PRICE" = "UNIT PRICE" + "TAXES.AMOUNT (COLUMN)" + "TAXES. PERCENTAGE (COLUMN)"
THE CHALLENGE IS THAT WITH DATE 12/10/2019 THE TAXES OF THE "TAXES" CHANGE CHANGED, THEREFORE, THE CALCULATIONS FROM THE 12/10/2019 DAY SHOULD BE ACHIEVED, TAKING INTO ACCOUNT THE NEW VALUES
I ATTACH A TABLE IN EXCEL FOR BETTER UNDERSTANDING WHAT I HOPE TO OBTAIN.
IT'S KNOWN THAT
AMOUNT (COLUMN) = TAXES [AMOUNT]
PERCENTAGE (COLUMN) = TAXES [PERCENTAGE] / 100 * SALES [UNIT PRICE]
PBIX: https://we.tl/t-aFHsGLJUE2
Excel: https://we.tl/t-Henr34LGhL
Thanks for confirmation..
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
19 Replies
- parry2k
Super User
ybatistamayo does IDCost & Date makes unique record in Taxes table?
- ybatistamayo
Helper III
YES, but keep in mind that the "Sales" table can have much more records. Thanks
- parry2k
Super User
ybatistamayo so add a Key column in both the tables and set relationship on this new key column and relationship will many to one, many on sales side and one on taxes table side.
Key = FORMAT( TAXES[IDCOST], "General Number" ) & FORMAT ( TAXES[DATE], "YYYYMMDD" ) Key = FORMAT( SALES[IDCOST], "General Number" ) & FORMAT ( SALES[DATE], "YYYYMMDD" )Once this relationship is created, you can RELATED function to get column value from Taxes table
- ybatistamayo
Helper III
HI, SOME VALUES DO NOT MATCH THE EXPECTED RESULT, FOR EXAMPLE RECORD # 2 PRODUCT B THE RESULTS OF AMOUNT TAXES MUST BE 2.5 AND IS GIVING 4.5. SEE ALSO RECORD # 6,
- amitchandak
Super User
This how I have taken. You need to suggest changes
1. Matched Product and ID cost and taken a date below the date of the sale. -- Min date
2. When I did not get the date in step 1, I removed the date of the sales and taken Min date. -- Min date 2 .. I think might require a change. Do we need to remove ID cost in such cases?