Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Measure Total Issue

Hello Everyone,

 

I have seen many questions related to Problem with Measure Total and saw many suggestions but still i couldn't get my answer

I want to get the sum of weight of material without moisture. For that i wrote my measure. The value for individual rows are correct, but the total is wrong. The Total should be 84( Without Moisture).  I tried many solutions but unfortunately didnt find any solution.

Here are 2 Measures :

1)

Weight_With_Moisture =
SUMX(
    SUMMARIZE(DimLine, DimLine[LineName],DimLine[Line], "XY", SUM(FactWeight[Weight in tonnes])),
     [XY])
 
2)
Weight_Without_Moisture =

var Moisture= SELECTEDVALUE(FactMoisture[Moisture %])

var MoistureAbsencePercentage=
1-DIVIDE(Moisture,100)

var Value_Without_Moisture=
FactWeight[Weight_With_Moisture]*MoistureAbsencePercentage

return
Value_Without_Moisture.
 
......................................................
Here are 3 images of the demo Reports

 

Picture 1:Picture 2:

Picture 3

 

Picture 1 --> Here i have also included Moisture% column and because of which the entries are getting doubled.

Picture 2--> Here The values of Column Weight_Without_moisture are correct but the total should be 84 instead of 100. 

 

Picture 3--> The relationhips between the table. 

 

Would really appreciate if somone could help me here. Thanking you in advance . 

 

  • Anonymous 

    re = 
    var ds=
    ADDCOLUMNS(
        SUMMARIZE(
            FactMoisture,
            DimDate[Date],
            DimLine[Line],
            FactMoisture[Moisture %]),
            "X", FactWeight[Weight_With_Moisture]*(1-DIVIDE(FactMoisture[Moisture %],100))
    )
    return
    SUMX(ds,[X])

     

     

    let me know if it works for you .

     

     

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠

6 Replies

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

    Anonymous 

    modification of t

    Weight_Without_Moisture =
    
    var ds= 
    addcolumns(
          summarize(
              factmoisture, 
              dimline[line],
             factmoisture[moisture %],
            FactWeight[Weight_With_Moisture]
          ),
         "@x", calculate ( factmoisture[moisture %] , 100) * FactWeight[Weight_With_Moisture]
    
    return
    sumx( ds, [@x])
    Value_Without_Moisture.

     

    this is the logic .

    some minor modifications are needed from your side  , but this should work .

     

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Daniel29195 

       

      Thank you for your quick reply. I tried your suggestion, but it is showing me a total of 170 instead of 84.

      Also in your measure you mentioned  :  

      ,
              FactWeight[Weight_With_Moisture]

      I could not write this in my measure.  

       

      Corrected Measure =

      var ds=
      ADDCOLUMNS(
          SUMMARIZE(
              FactMoisture,
              DimLine[Line],
              FactMoisture[Moisture %]),
              "X", FactWeight[Weight_With_Moisture]*(1-DIVIDE(FactMoisture[Moisture %],100))
      )
      return
      SUMX(ds, [X])


      Could you again help me? πŸ™‚

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

        Anonymous 

        are you able to sharethe power bi file ? 

        you can upload to google drive, dropbox and share a link. 

         

        NB:
        the measure that i ve wrote , is the logic of how it should be done. 

        since i dont have an idea of the data that you have how it is spreaded.