Forum Discussion

prob_powerBI's avatar
prob_powerBI
Regular Visitor
3 years ago
Solved

Performing analysis on grouped data?

I have some energy consumtption data (below) that i'm suing as a training dataset to help me learn PowerBI. I've come a decent way but have stumbled upon a problem that ive not been able to solve wi...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi prob_powerBI 

    Do you mean to sum the consumption of each day according to the date, and then divide the data into high consumption or low consumption, and then calculate the sum of consumption for each category according to this category?

    Here is a test file I created based on this understanding,

    1.create a new column to sum consumption of each day

    Column = SUMX(FILTER('Table (2)','Table (2)'[Text Before Delimiter]=EARLIER('Table (2)'[Text Before Delimiter])),[Consumption (kwh)])

     

    2.creata a new table to summarize the data(the type definition is just for the test)
    Table 2 = var a=SUMMARIZE('Table (2)','Table (2)'[Text Before Delimiter],[Column])
    var b=ADDCOLUMNS(a,"Type",SWITCH(TRUE(),[Column]>=11,"high",[Column]<10.6,"low"))
    return b.

    3.Sum it by the type

    Best Regards,

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.