Forum Discussion

saiftv's avatar
saiftv
Frequent Visitor
6 years ago
Solved

create visualization that sum LOAD_MW for all grid_code and display today, yesterday and last year

Can anyone help me please, I’m new in power bi,

On the table below I want to create visualization that sum all Load_mw for all grid_code for each R_Time for each day in R_date and to compare today load, yesterday and last year load

I created the visualization below for today time but I need to add yesterday and last year

 

 

 

 

 

 
  • hi,

     

    it works, i used below calculate

     

    last_year =
    (CALCULATE(
        SUM ( GRID_LOAD[LOAD_MW] ),
        ALLEXCEPT ( GRID_LOAD, GRID_LOAD[R_TIME]),
        DATEADD( ( GRID_LOAD[R_DATE]), - 1,YEAR)))

3 Replies

  • mwegener's avatar
    mwegener
    Most Valuable Professional

    Hi saiftv ,

     

    create a date table and link it to your table.

     

    Date = CALENDARAUTO()

     

    Mark the date table as date table.

    https://docs.microsoft.com/en-us/power-bi/desktop-date-tables

     

     

    Prev Day = CALCULATE(SUM('Table'[LOAD_MW]), PREVIOUSDAY('Date'[Date]))  
    Prev Year = CALCULATE(SUM('Table'[LOAD_MW]), PREVIOUSYEAR('Date'[Date]))  

     

    If I answered your question, please mark my post as solution, this will also help others.

    Please give Kudos for support.

    • saiftv's avatar
      saiftv
      Frequent Visitor

      Hi mwegener

      For the prev day is working fine, for the prev year it sum all previous year load_wm. I want something like this. Sum all load_wm of all grid_code for the hour 0.00, then for 1.00 and so on for today, and for yesterday and for the same date of last year.

      • saiftv's avatar
        saiftv
        Frequent Visitor

        hi,

         

        it works, i used below calculate

         

        last_year =
        (CALCULATE(
            SUM ( GRID_LOAD[LOAD_MW] ),
            ALLEXCEPT ( GRID_LOAD, GRID_LOAD[R_TIME]),
            DATEADD( ( GRID_LOAD[R_DATE]), - 1,YEAR)))