Forum Discussion

Vish_korg's avatar
Vish_korg
Frequent Visitor
1 year ago
Solved

Customize table formation

I am completey new to Power Bi .I require help to make a new table for the following data. Existing table Losses Down Time Break down 30 Start up loss 20 Clita 10...
  • BA_Pete's avatar
    1 year ago

    Hi Vish_korg ,

     

    You would do this using measures in your model and a basic table visual.

    Your measures would be calculated as follows, where 'YourTable' should be replaced with the actual name of your table in the model:

    Down Time Sum = SUM(YourTable[Down Time])
    Down Time Avg = AVERAGE(YourTable[Down Time])
    % Total Down Time = 
    VAR __TotalTime =
    CALCULATE(
        SUM(YourTable[Down Time]),
        ALLSELECTED(YourTable[Losses])
    )
    RETURN
    DIVIDE([Down Time Sum], __TotalTime, 0)

     

    Using these measures in a table visual with the [Losses] column from YourTable gives the following output:

     

     

     

    Pete

     

  • shafiz_p's avatar
    1 year ago

    Hi Vish_korg , Try belwo M code in power query advance option:

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Losses", type text}, {"Down Time", Int64.Type}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Losses"}, {{"Down Time", each List.Sum([Down Time]), type nullable number}, {"Down Time Avg", each List.Average([Down Time]), type nullable number}}),
        TotalSum = List.Sum(#"Grouped Rows"[Down Time]),
        AddPercentTotal = Table.AddColumn(#"Grouped Rows", "% of Total Time", each [Down Time]/TotalSum),
        #"Changed Type1" = Table.TransformColumnTypes(AddPercentTotal,{{"% of Total Time", Percentage.Type}})
    in
        #"Changed Type1"

     

    See images below for different steps:

     

     

    Hope this helps!!

    If this solved your problem, please accept it as a solution!!

     

     

    Best Regards,
    Shahariar Hafiz