Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Creating Invoice Net Amount USD Line in Power BI

Hi, I hope this message finds you well. I am reaching out to seek your expertise and assistance in replicating a specific feature from a Tableau report into Power BI. The challenge I am currently fac...
  • Daniel29195's avatar
    2 years ago

    hello Anonymous 

    what you are trying to achieve is a cumulative %. 

     

     

     

    sample data used : 

     

    measure : 

     

    code : 

    Measure 14 =

    var cumlative =
    CALCULATE(
        SUM('Table (15)'[qty]),
        WINDOW(
            0,
            ABS,
            0,
            REL,
            CALCULATETABLE(
            SUMMARIZE(
                'Table (15)',
                'Table (15)'[item]
            ),
            ALLSELECTED( 'Table (15)'[item]))
            ,
            ORDERBY('Table (15)'[item], ASC )
        )
    )

    var total =  CALCULATE(
        SUM('Table (15)'[qty]), ALLSELECTED( 'Table (15)'[item])
        )

        RETURN
        divide(cumlative, total, 0 )
       
     
     
    hope this works.

    Nb:   the orderby in the window function, should be the same as the order of the visual . 

     

    if the x-axis is randomly ordered, i would suggest to create a column to order this column . 
    this can be done as follow : 

    go to table view : 

    select the column in question

    go to sort by column

    choose the index . 

     

     

     

    hope this helps 

     

    best regards.