Forum Discussion

WiseFennec's avatar
WiseFennec
Frequent Visitor
3 years ago
Solved

Sumx not working properly.

Hello

 

I am working on a measure to calculate the gross sales of our products, below my measures :

G_TMS_LE = SUMX(F_TMS_Fcst,F_TMS_Fcst[TMS_Prices]*F_TMS_Fcst[TMS_LE])
G_TMS_LE_B = F_TMS_Fcst[TMS_Prices]*F_TMS_Fcst[TMS_LE]
 
The correct measure should be the first one, but it's working for the month of August and not July ?

Thanks in advance for your help

  • Hello

     

    thanks for your answer 

     

    I solved the issue :

     

    the code for the measure TMS_LE] is as below

    TMS_LE = SUM(A_TMS[A_TMS]) + SUM(F_OOR[F_OOR]) + SUM(F_TMS_Fcst[F_TMS_Fcst])

     

    I checked the data for each table and found that the measure G_TMS_LE is not working for the lines where F_TMS_Fcst is null, even though TMS_LE is working 

     G_TMS_LE = SUMX(F_TMS_Fcst,F_TMS_Fcst[TMS_Prices]*F_TMS_Fcst[TMS_LE])

     

    Replacing null by 0 made the trick. I should have known this but I am still a novice 😛

     

     

2 Replies

  • mlsx4's avatar
    mlsx4
    Memorable Member

    Hi WiseFennec 

     

    Are you sure you don't have any kind of filter by month?
    Try: G_TMS_LE = SUMX(VALUES(month), F_TMS_Fcst,F_TMS_Fcst[TMS_Prices]*F_TMS_Fcst[TMS_LE]))

    But I don't know if it is the problem. Can you provide sample data?

     

    • WiseFennec's avatar
      WiseFennec
      Frequent Visitor

      Hello

       

      thanks for your answer 

       

      I solved the issue :

       

      the code for the measure TMS_LE] is as below

      TMS_LE = SUM(A_TMS[A_TMS]) + SUM(F_OOR[F_OOR]) + SUM(F_TMS_Fcst[F_TMS_Fcst])

       

      I checked the data for each table and found that the measure G_TMS_LE is not working for the lines where F_TMS_Fcst is null, even though TMS_LE is working 

       G_TMS_LE = SUMX(F_TMS_Fcst,F_TMS_Fcst[TMS_Prices]*F_TMS_Fcst[TMS_LE])

       

      Replacing null by 0 made the trick. I should have known this but I am still a novice 😛