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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
th_moreira
Regular Visitor

Sum of bigger sum

Hi. Greetings from Brazil.

 

I am getting troubles to get the expected return. The situation is below:

 

- I have two different fact tables: one for accounting, and another for purchase order values

PO

po.png

Accounting

 

- I have then created dimension tables - calendar and code (code is like an application code.)

- I need to sum PO values, and accounting for each application. No problem with that.

- For each application, I also need to report biggest sum value - if PO is bigger, PO value; if accounting is bigger accounting value

I have created a Measure: 

Measure =

  IF( SUM(fPO[TOTAL]) > SUM(fAccounting[Value]),
  SUM(fPO[TOTAL]),
  SUM(fAccounting[Value]
  ))
 
This works very well when I have only one application code selected. But when I clear the filter, or filter more than one code, I have the sum of data, before the compare; when I need to compare line by line, and then sum. Using the same example dataset:
returning biggest sum, the return is 203, when I want to return 208.
 result.png
 
- I already have tried a column on application dimension table, but as I don't have a date column there, the sum ignores time filtering. So, just not works.
 
 
How to get that? Any idea?
 
Thanks for any help with that.
 
 
Thiago.

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @th_moreira 

 

It’s my pleasure to answer for you.

According to your description, I think you can create a measure with'summarize'.

Like this:

Measure 3 =
SUMX (
    SUMMARIZE (
        'Table (3)',
        'Table (3)'[code],
        "aaa",
            IF (
                SUM ( 'Table'[po value] ) > SUM ( 'Table (2)'[acc value] ),
                SUM ( 'Table'[po value] ),
                SUM ( 'Table (2)'[acc value] )
            )
    ),
    [aaa]
)

3.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

View solution in original post

4 REPLIES 4
v-janeyg-msft
Community Support
Community Support

Hi, @th_moreira 

 

It’s my pleasure to answer for you.

According to your description, I think you can create a measure with'summarize'.

Like this:

Measure 3 =
SUMX (
    SUMMARIZE (
        'Table (3)',
        'Table (3)'[code],
        "aaa",
            IF (
                SUM ( 'Table'[po value] ) > SUM ( 'Table (2)'[acc value] ),
                SUM ( 'Table'[po value] ),
                SUM ( 'Table (2)'[acc value] )
            )
    ),
    [aaa]
)

3.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

Wow, thats exactly what I need. 

 

Thank you. 

amitchandak
Super User
Super User

@th_moreira , try a measures like


sumx(values(Table[code]), IF( SUM(fPO[TOTAL]) > SUM(fAccounting[Value]),
SUM(fPO[TOTAL]),
SUM(fAccounting[Value]
)))

Hi. 

 

Thanks for your reply. Almost. The problem is when no application code is selected but other are (like dates, for example), when I think the sum is happening for all lines. Individually is correct.

result 2.png

New ideas?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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