Forum Discussion

Emranit's avatar
Emranit
Icon for Helper II rankHelper II
9 months ago
Solved

Regarding help for power BI DAX

https://docs.google.com/spreadsheets/d/1ZpK2aoR7Xo2Nnz4WfqAR0MJS1aWfBkJT/edit?usp=sharing&ouid=113914284006601104314&rtpof=true&sd=true Please check the link file firstly,   Each Day/Date one Mach...
  • danextian's avatar
    9 months ago

    Hi Emranit 

     

    You can use a measure to virtually summarize a table then multiple  virtual capacity column by 2.5, assuming there's only capacity value per day per machine. 

    Machine Capacity =
    SUMX (
        ADDCOLUMNS (
            SUMMARIZE ( 'Table', 'Table'[Date], 'Table'[Machine Name], 'Table'[Capacity] ),
            "@machine capacity", [Capacity] * 2.5
        ),
        [@machine capacity]
    )
    

    Otherwise you'll need to calculate the max capacity per machine per day virtual before multiplying it by 2.5

    Machine Capacity2 =
    SUMX (
        // Iterate over each unique Date–Machine combination
        ADDCOLUMNS (
            SUMMARIZE ( 'Table', 'Table'[Date], 'Table'[Machine Name] ),
            
            // Add a computed column for capacity × 2.5
            // CALCULATE is needed so MAX('Table'[Capacity]) is evaluated
            // in the filter context of each Date–Machine row produced by SUMMARIZE.
            "@machine capacity",
                CALCULATE( MAX( 'Table'[Capacity] ) ) * 2.5
        ),
    
        // Sum all values of the computed column
        [@machine capacity]
    )