The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello, I have a difficulty, I have a table that works as a matrix. I have the sellers in a column and the week number on the top line. Each week can have a different commission. I need to create a formula that returns the commission corresponding to each week to another table in order to calculate the commission amount for that week. Can you help me? Thanks, best regards.
Solved! Go to Solution.
Hi @silvapaulo22 ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a table and then the result is as follows.
Table 2 = DISTINCT(SELECTCOLUMNS('Table',"week1",SUM('Table'[1]),"week2",SUM('Table'[2]),"week3",SUM('Table'[3]),"week4",SUM('Table'[4]),"week5",SUM('Table'[5]),"week6",SUM('Table'[6]),"week7",SUM('Table'[7]),"week8",SUM('Table'[8])))
(3)Or you can click "transform data" to enter the Power Query editor and pivot the columns to change the source data, and then we can create a table.
Table 3 = DISTINCT( SELECTCOLUMNS('Table (2)',"Week",'Table (2)'[Week],"Commission",CALCULATE(SUM('Table (2)'[Commission]),FILTER('Table (2)','Table (2)'[Week]=EARLIER('Table (2)'[Week])))))
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @silvapaulo22 ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a table and then the result is as follows.
Table 2 = DISTINCT(SELECTCOLUMNS('Table',"week1",SUM('Table'[1]),"week2",SUM('Table'[2]),"week3",SUM('Table'[3]),"week4",SUM('Table'[4]),"week5",SUM('Table'[5]),"week6",SUM('Table'[6]),"week7",SUM('Table'[7]),"week8",SUM('Table'[8])))
(3)Or you can click "transform data" to enter the Power Query editor and pivot the columns to change the source data, and then we can create a table.
Table 3 = DISTINCT( SELECTCOLUMNS('Table (2)',"Week",'Table (2)'[Week],"Commission",CALCULATE(SUM('Table (2)'[Commission]),FILTER('Table (2)','Table (2)'[Week]=EARLIER('Table (2)'[Week])))))
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I think you have to modify your source table with unpivot:
If you need further help, pleace post some sample data from the source table
Proud to be a Super User!
User | Count |
---|---|
25 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |