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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
M_SBS_6
Helper V
Helper V

Calulation of values within the same column

Hi,

 

I have the following calculation that provides me with the majority of the output required and can be seen within the table below.

 

SUMX(

apps,

IF('apps'[app_cat] in {"INT","YTL","NB"} && apps[curr_month_or_after] = "No", "",

IF('apps'[app_cat] in {"INT"} && apps[curr_month_or_after] = "No" ||

'apps'[app_cat] = "INT" && 'apps'[app_type] = 1,

('apps'[amount] * apps[app_curr]) / 100,

'apps'[amount]))

)

 

app_catJanFebMarchAprilMayJuneJulyAugSep
INT1000001200001558002856120000    
YTL    5000070000855007500080000
NB    10002000210015001890
FR    15001500150015001500

 

However, what I need to do is where curr_month = "Yes" (i.e May) then I need a calculation that will say somthing like this:

SUM(IF('apps'[amount], 'apps'[app_cat] = "YTL" && apps[curr_month] = "Yes"

-  

'apps'[app_cat] = "INT" && apps[curr_month] = "Yes"

 

of which I have attempted to do here in red but the values don't change:

SUMX(
apps,

(if(apps[curr_month] = "Yes" && 'apps'[app_cat] = "YTL", 'apps'[amount]
-
if(apps[curr_month] = "Yes" && 'apps'[app_cat] = "INT", 'apps'[amount]),

IF('apps'[app_cat] in {"INT","YTL","NB"} && apps[curr_month_or_after] = "No", "",

IF('apps'[app_cat] in {"INT"} && apps[curr_month_or_after] = "No" ||

'apps'[app_cat] = "INT" && 'apps'[app_type] = 1,

('apps'[amount] * apps[app_curr]) / 100,

'apps'[amount]))

)


Then my table output should show like this (changes to the values in RED). So the value in May for app_cat "YTL" has a reduced value by 20000 as that's that value in app_cat "INT"

app_catJanFebMarchAprilMayJuneJulyAugSep
INT1000001200001558002856120000    
YTL    3000070000855007500080000
NB    10002000210015001890
FR    15001500150015001500


Any idea how I could look to add in this logic to my existing please? 

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

Hi @M_SBS_6 ,

According to your description, here's my solution.

SUMX (
    apps,
    IF (
        apps[curr_month] = "Yes"
            && 'apps'[app_cat] = "INT",
        'apps'[amount],
        IF (
            apps[curr_month] = "Yes"
                && 'apps'[app_cat] = "INT",
            'apps'[amount]
                - SUMX (
                    FILTER ( ALL ( apps ), apps[curr_month] = "Yes" && 'apps'[app_cat] = "INT" ),
                    'apps'[amount]
                ),
            IF (
                'apps'[app_cat]
                    IN { "INT", "YTL", "NB" }
                    && apps[curr_month_or_after] = "No",
                "",
                IF (
                    'apps'[app_cat]
                        IN { "INT" }
                        && apps[curr_month_or_after] = "No"
                        || 'apps'[app_cat] = "INT"
                        && 'apps'[app_type] = 1,
                    ( 'apps'[amount] * apps[app_curr] ) / 100,
                    'apps'[amount]
                )
            )
        )
    )
)

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

Best regards,

Community Support Team_yanjiang

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @M_SBS_6 ,

According to your description, here's my solution.

SUMX (
    apps,
    IF (
        apps[curr_month] = "Yes"
            && 'apps'[app_cat] = "INT",
        'apps'[amount],
        IF (
            apps[curr_month] = "Yes"
                && 'apps'[app_cat] = "INT",
            'apps'[amount]
                - SUMX (
                    FILTER ( ALL ( apps ), apps[curr_month] = "Yes" && 'apps'[app_cat] = "INT" ),
                    'apps'[amount]
                ),
            IF (
                'apps'[app_cat]
                    IN { "INT", "YTL", "NB" }
                    && apps[curr_month_or_after] = "No",
                "",
                IF (
                    'apps'[app_cat]
                        IN { "INT" }
                        && apps[curr_month_or_after] = "No"
                        || 'apps'[app_cat] = "INT"
                        && 'apps'[app_type] = 1,
                    ( 'apps'[amount] * apps[app_curr] ) / 100,
                    'apps'[amount]
                )
            )
        )
    )
)

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

Best regards,

Community Support Team_yanjiang

M_SBS_6
Helper V
Helper V

I don't suppose anyone has a suggestion at all please? I really don't know where to go with this. 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors