Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Calculate each row with different value entered manually

Hello,

 

Is it possible in PowerBI to make same caluclation with manually entered values for each row in the table.

For example I made this table in excel:

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous,

    Did these slicers are designed with same datasource table fields? If this is a case, current power bi not able to extract different selection from the same datasource slicer. You need to duplicate tables with those fields use different table fields in slicers.

    BTW, power bi not able to create dynamic calculate column/table based on filter/slicer, please use measure formal instead.

    Reference link and sample formula:

    What if Parameter for single row 

    Measure =
    MAX ( T1[Value] )
        * SWITCH (
            SELECTEDVALUE ( 'T1'[Key] ),
            1, SELECTEDVALUE ( S1[Value], SUM ( S1[Value] ) ),
            2, SELECTEDVALUE ( S2[Value], SUM ( S2[Value] ) ),
            3, SELECTEDVALUE ( S3[Value], SUM ( S3[Value] ) ),
            4, SELECTEDVALUE ( S4[Value], SUM ( S4[Value] ) ),
            5, SELECTEDVALUE ( S5[Value], SUM ( S5[Value] ) ),
            6, SELECTEDVALUE ( S6[Value], SUM ( S6[Value] ) ),
            BLANK ()
        )
    

    Notice: S1~ S6 are tables with fields that use on slicer.

    Regards,

    Xiaoxin Sheng

8 Replies

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

     

    I think that you forgot to paste the table.

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Sorry, here is the table:

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    In power bi, you can't do edit on row contents as excel.
    I'd like to suggest you add a measure, it can interact and calculate with current row contents and its results will be affected by filters. (you can use it to calculate in dax formula with current row and what if parameters)

    Create and use what-if parameters to visualize variables in Power BI Desktop 

    Regards,

    Xiaoxin Sheng

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      With What If parameter I can calculate all rows in the table with the same value. 

      What I need is to calculate each row with different value.

       

      I want to make a calculator in PowerBI where for each row the user will put different value, based on this value PowerBI should calculate just this row.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI Anonymous,

        Any index fields existed in your table? If this is a case, you can write a calculated column with a variable table to stored index and correspond rate to use defined value to calculate with current row content:

        DC =
        VAR dict =
            DATATABLE (
                "id", INTEGER,
                "rate", DOUBLE,
                {
                    { 1, 0.1 },
                    { 2, 0.2 },
                    { 3, 0.3 },
                    { 4, 0.4 },
                    { 5, 0.5 },
                    { 6, 0.6 }
                }
            )
        RETURN
            T1[value]
                * MAXX ( FILTER ( dict, [id] = T1[key] ), [rate] )
        

        Regards,

        Xiaoxin Sheng