powerbi - Hour over Hour calculation in Power BI -


i have dataset have date column, hour column , sale column.

edit 2: have added sample dataset additional column https://ufile.io/dq2av

date | hour | sales  1/1    1      1  1/1    2      2  1/1    3      3 

what calculated field more like

date | hour | sales | last hour 1/1    1      1       0  1/1    2      2       1  1/1    3      3       2 

does have experience this?

update #4: have solved combine of joe , marc. created sequence column

sequence = format(sheet1[click_date], "general number")+(.1*sheet1[dtclickhour]) 

fyi - if have large amount of records, please extend .1 .00001 because round whole number in sequence

index

index = rankx(sheet1, sheet1[sequence],,asc,dense) 

cake clicks last hour

cake clicks last hour = if(sheet1[dtclickhour]=0, 0, sumx(filter(sheet1,sheet1[index]=earlier(sheet1[index])-1),sheet1[cake clicks])) 

the step here change calculation of cake click last hours average.

the answer @joe provided worked me information above.

i started (which named table3):

enter image description here

and added new column using

`cake clicks last hour = calculate( if(isblank(max(table3[cake clicks])), 0, max(table3[cake clicks])), filter(table3,     table3[click_date] = earlier(table3[click_date]) &&     table3[dtclickhour] = earlier(table3[dtclickhour]) - 1 ) )` 

...which joe's code edited latest info (e.g., column's names).

if works you, please select answer.

otherwise, here alternative might you. started above table , derived this:

enter image description here

here's how:

  1. i added new column called "sequence" give me sequence count accounts both date , hour: sequence = format(table3[click_date], "general number")+(.1*table3[dtclickhour])

  2. i added new column called "index" i'd have identify record numbers: index = countrows(filter(table3,table3[sequence]<earlier(table3[sequence])))

  3. i added new column called "cake clicks last hour" used index determine value pull: cake clicks last hour = if(table3[dtclickhour]=0, 0, sumx(filter(table3,table3[index]=earlier(table3[index])-1),table3[cake clicks]))


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -