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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Jaweed
Helper III
Helper III

Renove record with Sum negative

 I would like to extract records from table, with 1 line per company.  Table is as per below, Negative sum of Outd Amount not to appear,

Customer           Invoice Num       Outd Amount        0-30d       31-60 d      61-90d       Over 90d        

A                              001                           100                                                   1000

A                             002                             300                              300

A                             003                           -500                                                                           -500

B                            004                             100                                100

B                            005                             400                                                    400

C                            006                              250                                                   250

Output: ( A does not appear as its sum of Outd Amount = -100)

B                                                                    500                               100            400

C                                                                    250                                                    250

   

Can anyone help. Struggling with this. Thank you.

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

hi, @Jaweed 

You could try these two ways as below:

1. Use this formula to create a new table

New Table = 
FILTER (
    SUMMARIZE (
        Basic,
        Basic[Customer],
        "Outd Amount", SUM ( Basic[Outd Amount] ),
        "0-30d", SUM ( Basic[0-30d] ),
        "31-60d", SUM ( Basic[31-60d] ),
        "61-90d", SUM ( Basic[61-90d] ),
        "Over 90d", SUM ( Basic[Over 90d] )
    ),
    [Outd Amount] > 0
)

Result:

5.JPG

 

2. create measure for each sum value column

Outd Amount measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[Outd Amount])))

0-30d measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[0-30d])))

31-60d measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[31-60d])))

61-90d measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[61-90d])))

Over 90d measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[Over 90d])))

Then drag Customer column and these measure into a table visual

6.JPG

Here is pbix file, please try it.

 

Best Regards,

Lin

Community Support Team _ Lin
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

3 REPLIES 3
Jaweed
Helper III
Helper III

Many thanks. 

v-lili6-msft
Community Support
Community Support

hi, @Jaweed 

You could try these two ways as below:

1. Use this formula to create a new table

New Table = 
FILTER (
    SUMMARIZE (
        Basic,
        Basic[Customer],
        "Outd Amount", SUM ( Basic[Outd Amount] ),
        "0-30d", SUM ( Basic[0-30d] ),
        "31-60d", SUM ( Basic[31-60d] ),
        "61-90d", SUM ( Basic[61-90d] ),
        "Over 90d", SUM ( Basic[Over 90d] )
    ),
    [Outd Amount] > 0
)

Result:

5.JPG

 

2. create measure for each sum value column

Outd Amount measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[Outd Amount])))

0-30d measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[0-30d])))

31-60d measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[31-60d])))

61-90d measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[61-90d])))

Over 90d measure = IF(CALCULATE(SUM(Basic[Outd Amount]))>0,CALCULATE(SUM(Basic[Over 90d])))

Then drag Customer column and these measure into a table visual

6.JPG

Here is pbix file, please try it.

 

Best Regards,

Lin

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

Thanks a lot for the help

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.