Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Create a custom report with Powerpivot - Newbie

$
0
0
I have imported an access database to Powerpivot


I have 3 tables [Broker] , [OPT], [TRS]. 

 - [Broker] have 2 fields `BRKR_CODE, Status`
 - [OPT] and [TRS] Have 5 same fields `BRKR1, BRKR2, Date, COM_BRK1, COM_BRKR2`


`OPT.BRKR1`, `OPT.BRKR2`, `TRS.BRKR1`, `TRS.BRKR2` are linked to `Broker.BRKR_CODE` and can be equal.

I want to get an array in excel with 3 columns Broker, OPT, TRS that does.... If `Broker.Status="Active"` then Select `Broker.BRKR_CODE`
and then for each `Broker.BRKR_CODE` (for example "CB") do the Sum of `OPT.COM_BRKR1` when `OPT.BRKR1="CB"` + Sum of `OPT.COM_BRKR2` when `OPT.BRKR2="CB"`  and  do the Sum of `TRS.COM_BRKR1` when `TRS.BRKR1="CB"`+ Sum of `TRS.COM_BRKR2` when `TRS.BRKR2="CB"` and add date slicer per quarter, per year, or custom date


This could be an SQL code of what I want to do... but it is very slow in SQL so I want to try with Powerpivot and I never used it.

    
SELECT Broker.BRKR_CODE,
           Sum(OPT.COM_BRKR1)+ Sum(OPT.COM_BRKR2) AS OPT_Tot,
           Sum(TRS.COM_BRKR1)+ Sum(TRS.COM_BRKR2) AS TRS_Tot
    FROM Broker 
         INNER JOIN  OPT
         ON (Broker.BRKR_CODE = OPT.BRKR2) OR (Broker.BRKR_CODE = OPT.BRKR1)
          INNER JOIN  TRS
         ON (Broker.BRKR_CODE = TRS.BRKR2) OR (Broker.BRKR_CODE = TRS.BRKR1)
    WHERE Broker.Status = "Active"
    GROUP BY Broker.BRKR_CODE



Would be grateful if someone can help

 

Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>