Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Sum up values in column

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

Eagle77_0-1623048947399.png

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?

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

View solution in original post

7 REPLIES 7
v-xulin-mstf
Community Support
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
Not applicable

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

Fowmy
Super User
Super User

@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?


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.

@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]
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

I tested the code but it seems that it doesn't work when I select values from slicer. I changed the measure to :

 

Length :=
calculate(
SUMX (
    ADDCOLUMNS (
        SUMMARIZE ( 'Fact2', 'Fact2'[OrderKey] ),
        "sum of length", CALCULATE ( MAX ( 'Fact2'[length] ) )
    ),
    [sum of length]
)
, FILTER (
        'Fact2',
        'Fact2'[OrderKey] IN VALUES ( 'Fact1'[OrderKey])
           )
)

 

 

But it doesn't show the correct value. It sums up all orderkeys without any concern to selection in slicer.

@Anonymous 

I am not sure how your model and the relationships are defined, you may share a sample PBIX file to check what sort of issues you are facing.



Also, explain the out put you are trying to achieve.


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.