Forum Discussion

xexeu's avatar
xexeu
New Member
4 years ago
Solved

Caculate simple formula using filter getting wrong

Hi Guys,

 

I'm new on PowerBI and I'm testing a formula that the result is getting wrong. The result is getting another filter that I didn't applied on the formula...

 

As we can see on day 01 is getting 130, but the right result is 129 as we can see below, the formula is getting another "tipo" on the column and sum in the result:

 

 

Powerbi shoud apply the sum when the column tipo is "Backlog"

 

Anyone know why this is happing?

 

  • xexeu 

     

    Do you want a measure or a new column? the previous post I shared is good if you want to create a measure, if you want a new column use this:

    Unflow =
    CALCULATE (
        SUM ( '001_03_tblHistorica'[QTD] ),
        FILTER (
            '001_03_tblHistorica',
            '001_03_tblHistorica'[Tipo] = "Backlog"
                && '001_03_tblHistorica'[Visao] = EARLIER ( '001_03_tblHistorica'[Visao] )
        )
    )

     

    or just use the below one to show the value if the TIPO=Backlog:

    New Column =
    IF(Tipo] = "Backlog",[QTD],blank())

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/

     

     

7 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion

    xexeu  Can you share a screenshot of your data model relationships view please? 

     

    Also, have you renamed the fields in the visual? Your visual is showing 'Inflow' but I don't see that in your DAX formula. 

  • Hi xexeu 

     

    Try this:

    Unflow =
    CALCULATE (
        SUM ( '001_03_tblHistorica'[QTD] ),
        FILTER ( '001_03_tblHistorica', '001_03_tblHistorica'[Tipo] = "Backlog" )
    )

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/

     

     

    • xexeu's avatar
      xexeu
      New Member

      Hi VahidDM,

       

      I've tried this one, but got another mistake as you can see bellow

       

       

      • VahidDM's avatar
        VahidDM
        Super User

        xexeu 

         

        Do you want a measure or a new column? the previous post I shared is good if you want to create a measure, if you want a new column use this:

        Unflow =
        CALCULATE (
            SUM ( '001_03_tblHistorica'[QTD] ),
            FILTER (
                '001_03_tblHistorica',
                '001_03_tblHistorica'[Tipo] = "Backlog"
                    && '001_03_tblHistorica'[Visao] = EARLIER ( '001_03_tblHistorica'[Visao] )
            )
        )

         

        or just use the below one to show the value if the TIPO=Backlog:

        New Column =
        IF(Tipo] = "Backlog",[QTD],blank())

         

        If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
        Appreciate your Kudos!!
        LinkedIn: 
        www.linkedin.com/in/vahid-dm/