Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Sum up values in column

The following is a part of the modell which my report is based on( all relations are 1:*).

There is no connection between fact1 and fact2 tables and in report there are two slicers read data from dim1 and dim2(I can't send any example of report or data). 

There is a column in fact2 that I need to sum up . Here is my measure in fact2 table and it doesn't show correct value in report:

 

 

 

Length:= 

        SUMX(
            SUMMARIZE(
              'Fact2'
             ,'Fact2'[OrderKey]      --both fact1 and fact2 has this key  
             ,"sum of length", MAX('Fact2'[length]) --it's a decimal value                      
            ),[sum of length]              
	 )

 

 

 

 

Do you have any suggestion how this measure should be changed?

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Thanks v-xulin-mstf for your reply. The issue is resolved by changing the tabular model and measure. 

7 Replies

  • Anonymous 

    When you say "it doesn't show correct value in report" how do you use this measure, against which dimension or what is the context?


    • Anonymous's avatar
      Anonymous
      Not applicable

      I'm using the measure as a column in a simple table in report. In report when I select related values from slicers(dim1 and dim2) for a specific order, measure doesn't show the correct value.

      • Fowmy's avatar
        Fowmy
        Super User

        Anonymous 

        The measure you created is supposed to summarize the FACT 2 table by orderkey and get the maximum value for each orderkey and sum them right? So, you are slicing by the given dimension and you do not want to calculate anything from FAC 1.

        Can you try this version?

        Length =
        SUMX (
            ADDCOLUMNS (
                SUMMARIZE ( 'Fact2', 'Fact2'[OrderKey] ),
                "sum of length", CALCULATE ( MAX ( 'Fact2'[length] ) )
            ),
            [sum of length]
        )
        

         

  • v-xulin-mstf's avatar
    v-xulin-mstf
    Community Support

    Hi Anonymous,

     

    Based on my test, your measure is not reporting errors.
    Can you provide your expected output, or use some dummy data for an example?
    I will test it in my environment based on the details you provided.

     

    Best Regards,
    Link

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks v-xulin-mstf for your reply. The issue is resolved by changing the tabular model and measure.