Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DAX HELP

Below formula giving wrong value.
Please help
 
INVOICED QTY =
CALCULATE(SUM(SO_BI_FACT[QTY]),
FILTER(SO_BI_FACT,
SO_BI_FACT[CLASSIFICATION] <> "C&I"
&& SO_BI_FACT[FLAG]=1 ))
+
CALCULATE(SUM(SO_BI_FACT[QTY2]),
FILTER(SO_BI_FACT,
SO_BI_FACT[CLASSIFICATION] = "C&I"))

  • shebr wrote:

    Hi Anonymous 

     

    Can you try this as a measure? Let me know how you get on? Are you expecting 1700 as your value?

     

    My Calc =
    var one = CALCULATE(SUM(SO_BI_FACT[QTY]),
    FILTER(SO_BI_FACT,
    SO_BI_FACT[CLASSIFICATION] <> "C&I"
    && SO_BI_FACT[FLAG]=1 ))

    VAR two = CALCULATE(SUM(SO_BI_FACT[QTY2]),
    FILTER(SO_BI_FACT,
    SO_BI_FACT[CLASSIFICATION] = "C&I"))

    return CALCULATE(one + two, ALL(SO_BI_FACT))

    Anonymous did you try this measure?

19 Replies

  • az38's avatar
    az38
    Community Champion

    Hi Anonymous 

    congrats 🙂

    any details?

    the most common error in your case - is not using ALL() inside filter. But it is the step in the dark from my side

    INVOICED QTY =
    CALCULATE(SUM(SO_BI_FACT[QTY]),
    FILTER(ALL(SO_BI_FACT),
    SO_BI_FACT[CLASSIFICATION] <> "C&I"
    && SO_BI_FACT[FLAG]=1 ))
    +
    CALCULATE(SUM(SO_BI_FACT[QTY2]),
    ALL(SO_BI_FACT),
    SO_BI_FACT[CLASSIFICATION] = "C&I")
    • Anonymous's avatar
      Anonymous
      Not applicable

      Same result bro.

    • Anonymous's avatar
      Anonymous
      Not applicable
      SO IDCLASSIFICATIONFLAGQTYQTY2
      1C&I0 100
      2EBO1200 
      3EBO1100 
      4C&I1 500
      5C&I0 800
      • shebr's avatar
        shebr
        Resolver III

        Hi Anonymous 

         

        Can you try this as a measure? Let me know how you get on? Are you expecting 1700 as your value?

         

        My Calc =
        var one = CALCULATE(SUM(SO_BI_FACT[QTY]),
        FILTER(SO_BI_FACT,
        SO_BI_FACT[CLASSIFICATION] <> "C&I"
        && SO_BI_FACT[FLAG]=1 ))

        VAR two = CALCULATE(SUM(SO_BI_FACT[QTY2]),
        FILTER(SO_BI_FACT,
        SO_BI_FACT[CLASSIFICATION] = "C&I"))

        return CALCULATE(one + two, ALL(SO_BI_FACT))
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    Can someone help me with dax.

     

    I created 2 measures that take the start date & end Date of the slicer.

     

    StartDate = calculate(min(datetable[date]),allselected(datetable[date]))
    EndDate = calculate(max(datetable[date]),allselected(datetable[date]))

     

    I want to create a column that shows-that a particular card is expired or not.

     

    Expired = IF([End Date] > 'Card Type'[GracePeriodEndDate] ,1,0)

     

    I am using this formulae but this is giving 0 for all the rows.

     

    Pls have look at this screenshots

    • Anonymous's avatar
      Anonymous
      Not applicable

      Relationship is wrong.

      Join Date column with Grace Period End Date