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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
AllanBerces
Post Prodigy
Post Prodigy

Combine Sum two value in one column

Hi can anyone help me correct my calculated column, i want the sum of remaining of group1 and 2 on my column. Show error when i try to used below.

 

TA_Total_Column_Remaining =
VAR CurrentDate = TODAY()
VAR CurrentGroup = 'Table'[Trade] IN {"Group01", "Group02"}
RETURN
    CALCULATE(
        SUM('Table'[Remaining]),
        FILTER(
            'Table',
            'Table'[PlanDate] = CurrentDate &&
            'Table'[Trade] = CurrentGroup
 
Thank you
2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how the expected result looks like, but please try something like below, and please check whether it works.

Thank you.

 

TA_Total_Column_Remaining =
VAR CurrentDate =
    TODAY ()
VAR CurrentGroup = { "Group01", "Group02" }
RETURN
    CALCULATE (
        SUM ( 'Table'[Remaining] ),
        FILTER (
            'Table',
            'Table'[PlanDate] = CurrentDate && 'Table'[Trade] IN CurrentGroup
        )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

Poojara_D12
Super User
Super User

Hi @AllanBerces 

The error in your DAX formula occurs because of how you are using the variable CurrentGroup and the IN operator. In DAX, you can’t assign a logical expression like 'Table'[Trade] IN {"Group01", "Group02"} to a variable and then later compare a column directly to that variable — it results in an invalid data type or logical context error. Also, using CALCULATE inside a calculated column can behave unexpectedly, since it changes the evaluation context for each row, not for an aggregated total. To correctly get the sum of the ‘Remaining’ column for only Group01 and Group02 on the same PlanDate as the current row, you can rewrite your formula like this:

TA_Total_Column_Remaining =
VAR CurrentDate = 'Table'[PlanDate]
RETURN
CALCULATE(
    SUM('Table'[Remaining]),
    FILTER(
        'Table',
        'Table'[PlanDate] = CurrentDate &&
        'Table'[Trade] IN {"Group01", "Group02"}
    )
)

In this corrected version, the variable CurrentDate stores the row’s PlanDate, and the FILTER function checks for rows in the table that share that same date and belong to Group01 or Group02. The SUM inside CALCULATE then adds up the “Remaining” values for those matching rows. This ensures that for each row in your table, the calculated column correctly displays the total “Remaining” amount for both groups combined for that specific date.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

View solution in original post

4 REPLIES 4
Poojara_D12
Super User
Super User

Hi @AllanBerces 

The error in your DAX formula occurs because of how you are using the variable CurrentGroup and the IN operator. In DAX, you can’t assign a logical expression like 'Table'[Trade] IN {"Group01", "Group02"} to a variable and then later compare a column directly to that variable — it results in an invalid data type or logical context error. Also, using CALCULATE inside a calculated column can behave unexpectedly, since it changes the evaluation context for each row, not for an aggregated total. To correctly get the sum of the ‘Remaining’ column for only Group01 and Group02 on the same PlanDate as the current row, you can rewrite your formula like this:

TA_Total_Column_Remaining =
VAR CurrentDate = 'Table'[PlanDate]
RETURN
CALCULATE(
    SUM('Table'[Remaining]),
    FILTER(
        'Table',
        'Table'[PlanDate] = CurrentDate &&
        'Table'[Trade] IN {"Group01", "Group02"}
    )
)

In this corrected version, the variable CurrentDate stores the row’s PlanDate, and the FILTER function checks for rows in the table that share that same date and belong to Group01 or Group02. The SUM inside CALCULATE then adds up the “Remaining” values for those matching rows. This ensures that for each row in your table, the calculated column correctly displays the total “Remaining” amount for both groups combined for that specific date.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how the expected result looks like, but please try something like below, and please check whether it works.

Thank you.

 

TA_Total_Column_Remaining =
VAR CurrentDate =
    TODAY ()
VAR CurrentGroup = { "Group01", "Group02" }
RETURN
    CALCULATE (
        SUM ( 'Table'[Remaining] ),
        FILTER (
            'Table',
            'Table'[PlanDate] = CurrentDate && 'Table'[Trade] IN CurrentGroup
        )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Hi @Jihwan_Kim thank you very much working as i need

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.