Untitled

 avatar
unknown
plain_text
4 months ago
3.1 kB
5
Indexable
Value.NativeQuery(
        PostgreSQL.Database("pgpaas-powerhub-prod-001.postgres.database.azure.com", "ulpodspg001", [HierarchicalNavigation=true]), 
            "select 
                    bm_unit as ""BM Unit"",
                            settlement_day as ""Settlement Day"",
                                    period as ""Settlement Period"",
                                            sum(coalesce(fpn, 0)) as ""FPN"",
                                                    sum(coalesce(fpn, 0) + (coalesce(abv, 0) * 2) + (coalesce(aov, 0) * 2)) as ""QME"",
                                                            sum(coalesce(abv, 0)) as ""ABV"",
                                                                    sum(coalesce(aov, 0)) as ""AOV""
                                                                        from bo_user_uniper.mi_bmu_prd
                                                                            where bm_unit in (
                                                                                        'E_BRGG-1','E_BRYP-1','E_CORB-1','E_KLYN-A-1','E_PETEM1','E_ROOS-1','E_SHOS-1','T_BAGE-1','T_BARK-1','T_BARKB2',
                                                                                                'T_CDCL-1','T_CNQPS-1','T_CNQPS-2','T_CNQPS-3','T_CNQPS-4','T_COSO-1','T_DAMC-1','T_DEEP-1','T_DIDCB5','T_DIDCB6',
                                                                                                        'T_EECL-1','T_GRAI-6','T_GRAI-7','T_GRAI-8','T_HUMR-1','T_KEAD-1','T_KILLPG-1','T_KILLPG-2','T_KILNS-1','T_LAGA-1','T_LBAR-1',
                                                                                                                'T_MEDP-1','T_MRWD-1','T_PEHE-1','T_PEHE-2','T_PEMB-11','T_PEMB-21','T_PEMB-31','T_PEMB-41','T_PEMB-51','T_ROCK-1','T_RYHPS-1',
                                                                                                                        'T_SCCL-1','T_SCCL-2','T_SCCL-3','T_SEAB-1','T_SEAB-2','T_SHBA-1','T_SHBA-2','T_SPLN-1','T_STAY-1','T_STAY-2','T_STAY-3','T_STAY-4',
                                                                                                                                'T_SUTB-1','T_SVRP-10','T_SVRP-20','T_TESI-1','T_TESI-2','T_WBURB-1','T_WBURB-2','T_WBURB-3'
                                                                            ) 
                                                                                and settlement_day between '2023-01-01 00:00:00'::timestamp and current_timestamp
                                                                                    group by bm_unit, settlement_day, period
                                                                                        order by bm_unit, settlement_day, period",
                                                                                            null, 
                                                                                                [EnableFolding=true]
)

                                                                            )
)
Editor is loading...
Leave a Comment