Forum Discussion

Dunner2020's avatar
Dunner2020
Icon for Post Prodigy rankPost Prodigy
6 years ago

Summing the measure

Hi there,

 

I have data which looks like the following table:

 

IncidentTimeNumberOfConsumersInterruptionDurationTotalConsumerMinutesEpoch Half Hour Number
Saturday, 4 April 202019700355191
Sunday, 5 April 20200970355201
Sunday, 5 April 202069171173355214
Sunday, 5 April 20208435229568355202
Sunday, 5 April 202015300355202
Sunday, 5 April 20206933423046355202
Monday, 6 April 20201232232355266
Thursday, 9 April 20208911310057355430
Thursday, 9 April 2020171332261355430
Thursday, 9 April 202078967488355426
Monday, 13 April 2020558290355605
Wednesday, 15 April 20200220355681
Monday, 6 April 2020287174355274
Monday, 6 April 20201315315355267
Monday, 20 April 2020012030355923
Monday, 20 April 20201759810166355943
Thursday, 23 April 2020080356110
Thursday, 23 April 20204400356110
Thursday, 23 April 202026881376356110
Wednesday, 29 April 2020781239594356382
Wednesday, 29 April 2020513105130356382
Wednesday, 29 April 20205132613338356385
Tuesday, 7 April 20203354515075355331
Tuesday, 14 April 202045011149950355660
Tuesday, 14 April 202020412124684355660
Tuesday, 14 April 2020434172355653
Tuesday, 14 April 202044472068355660
Tuesday, 14 April 2020312343702355660
Tuesday, 14 April 20200170355659
Tuesday, 14 April 20200170355658
Tuesday, 14 April 2020651100355659
Tuesday, 14 April 20209832019660355659
Friday, 24 April 20204411441356153
Tuesday, 28 April 202044300356349
Monday, 4 May 202073902730356610
Monday, 4 May 2020243598616356610
Tuesday, 5 May 2020129364644356667
Tuesday, 5 May 202042391638356675
Tuesday, 5 May 2020251192975356677
Tuesday, 5 May 2020654260356684
Tuesday, 5 May 202061741044356677
Tuesday, 5 May 2020652130356685
Tuesday, 5 May 2020133053965356677
Tuesday, 5 May 2020341615474356677
Tuesday, 5 May 2020527364356663
Tuesday, 5 May 202014541259740356660
Tuesday, 5 May 202052733796356660
Tuesday, 5 May 20206041324780356660
Tuesday, 5 May 202013812817664356660
Tuesday, 5 May 2020311133503356660
Tuesday, 5 May 20206048350132356660
Wednesday, 6 May 202002990356706
Wednesday, 6 May 2020214379177356706
Wednesday, 6 May 20202444888356706
Wednesday, 6 May 20202280560356707
Friday, 8 May 202012600356785
Saturday, 9 May 2020401234920356850
Tuesday, 5 May 2020132953835356658
Tuesday, 5 May 2020101851850356659
Tuesday, 12 May 2020451637335356999
Tuesday, 12 May 20201922418356999
Wednesday, 13 May 2020252807000357049
Wednesday, 13 May 2020342428228357049
Wednesday, 13 May 20206762818928357049
Thursday, 14 May 20201418252357092
Thursday, 14 May 2020152513765357086
Thursday, 14 May 2020149126357094
Thursday, 14 May 202064042560357093
Thursday, 14 May 202042184357093
Thursday, 14 May 202064042560357093
Wednesday, 6 May 20207473526145356705
Thursday, 14 May 2020018900357088
Thursday, 14 May 2020248357087
Thursday, 14 May 20202816357100
Tuesday, 19 May 20201428428357331
Wednesday, 20 May 20200320357406
Wednesday, 20 May 20206000357368
Wednesday, 20 May 2020164216736357368
Wednesday, 20 May 202027493493466357373
Wednesday, 20 May 20200220357390

 

 Epoch Half Hour Number in the table shows the half an hour interval. 

I want to create four measures to perform calculations. In the first measure (which looks like below) calculates the raw value happened in half an hour time period:

first_measre_30mins = 

var Time30Min = MAX('Table'[Epoch Half Hour Number])
Return
CALCULATE ( SUMX(FILTER(filter(ALL('Table'),'Table'[Epoch Half Hour Number] = Time30Min),table[TotalConsumerMinutes] >= 0,'Outages and Interruptions'[TotalConsumerMinutes]))/90000
 
In the second measure, I do the same calculation but for last 24 hrs. My second measure looks like following
 
Second_measure_24hrs = 
var Time30Min = MAX('Table'[Epoch Half Hour Number])
Return
CALCULATE ( SUMX(FILTER(filter(ALL('Table'),'Table'[Epoch Half Hour Number] <= Time30Min && 'Table'[Epoch Half Hour Number] >= Time30Min-47),Table[TotalConsumerMinutes]>= 0),'Table'[TotalConsumerMinutes]))/90000
 
In third measure, I normalize the value calculated in the first measure. So my third measure looks like:
Normalize_first_measure_30mins = 
IF([Second_measure_24hrs ] > 5.69 && [first_measre_30mins ] > 5.69/48,5.69/48,[first_measre_30mins ])
 
Now in the fourth measure, I want to sum up third measure (which is normalise value of 30 mins) in such a way that it sum upall third measure values occurred in the last 24 hours. 
 
I am a bit lost now and could not figure out how to do that. Could anyone help me with that?
 
 

3 Replies

  • v-xuding-msft's avatar
    v-xuding-msft
    Icon for Community Support rankCommunity Support

    Hi Dunner2020 ,

     

    I'm not clear about the logic of the sample data and measures either. But if you want to summarize the third measure, you could try like below and change 'Table' to Filter(table,  expressions)  to add filter conditions of last 24 hours. 

    Measure = SUMX('Table',[Normalize_first_measure_30mins])

     

    If you still can't solve it, please share the computing logic and your expected result. Thanks!

     

     

     

    • v-xuding-msft's avatar
      v-xuding-msft
      Icon for Community Support rankCommunity Support

      Hi Dunner2020 ,

       

      Could you tell me if your problem has been solved? If it is, kindly share your solutions. More people who encounter the same issue will benefit from here. If you are still confused about it, please share more details to us.