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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sajjadansari
Frequent Visitor

DAX Function for sum Multiple Row

Total Sales 2024 = SUMX(CALCULATETABLE('Combine-YTD',FILTER('Combine-YTD','Combine-YTD'[TYPE]="Sales")),'Combine-YTD'[Jan-24]+'Combine-YTD'[Feb-24]+'Combine-YTD'[Mar-24]+'Combine-YTD'[Apr-24]+'Combine-YTD'[May-24]+'Combine-YTD'[Jun-24]+'Combine-YTD'[Jul-24]+'Combine-YTD'[Aug-24]+'Combine-YTD'[Sep-24]+'Combine-YTD'[Oct-24]+'Combine-YTD'[Nov-24]+'Combine-YTD'[Dec-24])
1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

Hi @sajjadansari ,
Why not just unpivot your data table and create three columns such as Type, Month-Year, Sales. Unpivoting your data can indeed simplify your DAX calculations and make your data model more flexible. By unpivoting, you transform your wide table (with one column per month) into a long table (with one column for months and another for values). This approach can make it easier to perform time-based calculations and aggregations.

If you want to unpivot, go to power query > Select the columns for the months (e.g., Jan-24 to Dec-24) > Right-click on the selected columns and choose Unpivot Columns. > This will transform your data into a long format with columns for Attribute (month) and Value (sales amount) > Rename the Attribute column to Month-Year and the Value column to Sales > ClickClose & Apply to load the transformed data back into Power BI.

However, if you want maintain wider table, then you can try this:

 

Total Sales 2024 = 
SUMX(
    FILTER(
        'Combine-YTD',
        'Combine-YTD'[TYPE] = "Sales"
    ),
    'Combine-YTD'[Jan-24] + 'Combine-YTD'[Feb-24] + 'Combine-YTD'[Mar-24] + 
    'Combine-YTD'[Apr-24] + 'Combine-YTD'[May-24] + 'Combine-YTD'[Jun-24] + 
    'Combine-YTD'[Jul-24] + 'Combine-YTD'[Aug-24] + 'Combine-YTD'[Sep-24] + 
    'Combine-YTD'[Oct-24] + 'Combine-YTD'[Nov-24] + 'Combine-YTD'[Dec-24]
)

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

 

Best Regards,
Shahariar Hafiz

 

View solution in original post

3 REPLIES 3
shafiz_p
Super User
Super User

Hi @sajjadansari ,
Why not just unpivot your data table and create three columns such as Type, Month-Year, Sales. Unpivoting your data can indeed simplify your DAX calculations and make your data model more flexible. By unpivoting, you transform your wide table (with one column per month) into a long table (with one column for months and another for values). This approach can make it easier to perform time-based calculations and aggregations.

If you want to unpivot, go to power query > Select the columns for the months (e.g., Jan-24 to Dec-24) > Right-click on the selected columns and choose Unpivot Columns. > This will transform your data into a long format with columns for Attribute (month) and Value (sales amount) > Rename the Attribute column to Month-Year and the Value column to Sales > ClickClose & Apply to load the transformed data back into Power BI.

However, if you want maintain wider table, then you can try this:

 

Total Sales 2024 = 
SUMX(
    FILTER(
        'Combine-YTD',
        'Combine-YTD'[TYPE] = "Sales"
    ),
    'Combine-YTD'[Jan-24] + 'Combine-YTD'[Feb-24] + 'Combine-YTD'[Mar-24] + 
    'Combine-YTD'[Apr-24] + 'Combine-YTD'[May-24] + 'Combine-YTD'[Jun-24] + 
    'Combine-YTD'[Jul-24] + 'Combine-YTD'[Aug-24] + 'Combine-YTD'[Sep-24] + 
    'Combine-YTD'[Oct-24] + 'Combine-YTD'[Nov-24] + 'Combine-YTD'[Dec-24]
)

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

 

Best Regards,
Shahariar Hafiz

 

Dear Mr. 

Shahariar Hafiz

i shared DAX Function to summing up multiple column, ( i am not looking solution) its already a solution.

 

Thanks for Understanding.

 

Mr. 

Shahariar Hafiz

i shared Solution (DAX Function) not a Problem.

Thanks for Understanding.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.