Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a SQL table with sales data that I want to "categorize" in a pivot table.
InvoiceLines:
SKU | Price | Cost | Units | Date |
---|---|---|---|---|
123 | 120 | 90 | 2 | |
124 | 98 | 45 | 1 | |
125 | 75 | 70 | 1 |
I want to categorize my pivot table to look like this:
Jan | Feb | Mar | |
---|---|---|---|
Sales | sum(Price*Units) | sum(Price*Units) | sum(Price*Units) |
Cost | sum(Cost*Units) | sum(Cost*Units) | sum(Cost*Units) |
Profit | sum((Price-Cost)*Units) | sum((Price-Cost)*Units) | sum((Price-Cost)*Units) |
How do I create categories like in the left column? Any help are appreciated.
Create a regular pivot table with Month Dimension and your expressions.
Move the Month to column and values (basically the expressions) to Row and you should achieve it. See below !
Create a regular pivot table with Month Dimension and your expressions.
Move the Month to column and values (basically the expressions) to Row and you should achieve it. See below !
i am not seen anywhere field holding month names. can you share exactly how looks the table in DB?
Thanks Dilip for helping out!