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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

DAX formula

Hi all,

 

Dates are the columns and it goes until 4/1/22.

 

How can I add it all and get the sum at the end.

Also, the data keeps changing and the total should change accordingly.

How can I do that?

 

 

Megha3012_1-1641392843628.png

 

Any help would be appreciated!

 

Thank you!

Megha

 

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 


 

Megha3012_1-1641392843628.png


This table is a two-dimensional table. It is common in Excel. Two-dimensional tables have these advantages:

1. more in line with reading habits;

2. more condensed information;

3. suitable for displaying results.

 

However, when performing data analysis as source data, a one-dimensional table is more suitable. 

 

So it is suggested to keep you data like below and show your data use Matrix visual as what @AlexisOlson mentioned. It can show data as a 2D table.

 

Icey_0-1641793667955.png

 

Without considering other issues, consider this situation you mentioned:


 

Dates are the columns and it goes until 4/1/22.

 

How can I add it all and get the sum at the end.

Also, the data keeps changing and the total should change accordingly.

 


If you have dates as column names, when a new date generates, a new column generates in Power BI accordingly. But Power BI won't recognize the new column and an error like "can't find column "xxx"" will occur. This way your data can't be refreshed dynamically.

 

Hope I explained it clearly.

 

 

Best Regards,

Icey

 

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

9 REPLIES 9
Icey
Community Support
Community Support

Hi @Anonymous ,

 


 

Megha3012_1-1641392843628.png


This table is a two-dimensional table. It is common in Excel. Two-dimensional tables have these advantages:

1. more in line with reading habits;

2. more condensed information;

3. suitable for displaying results.

 

However, when performing data analysis as source data, a one-dimensional table is more suitable. 

 

So it is suggested to keep you data like below and show your data use Matrix visual as what @AlexisOlson mentioned. It can show data as a 2D table.

 

Icey_0-1641793667955.png

 

Without considering other issues, consider this situation you mentioned:


 

Dates are the columns and it goes until 4/1/22.

 

How can I add it all and get the sum at the end.

Also, the data keeps changing and the total should change accordingly.

 


If you have dates as column names, when a new date generates, a new column generates in Power BI accordingly. But Power BI won't recognize the new column and an error like "can't find column "xxx"" will occur. This way your data can't be refreshed dynamically.

 

Hope I explained it clearly.

 

 

Best Regards,

Icey

 

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

Anonymous
Not applicable

@Icey Thank you so much for clear explanation!

smpa01
Community Champion
Community Champion

@Anonymous  first tsep unpivot the data in PQ


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================
Anonymous
Not applicable

Hi @smpa01 ,

 

Thank you for your response!

 

But I want the data to be viewed that way. And hence I did pivot.

Is there any other way?

 

Thank you!

Megha

Just because you want the data to be viewed that way doesn't mean it should be stored that way in the model. If you unpivot it, you can still easily put it back in this format with a matrix visual.

 

Even if you don't ultimately want to have it unpivoted, you can unpivot it to do calculations much more easily and then re-pivot it at the end to get it back in that format.

Anonymous
Not applicable

If I do not pivot, this is how it looks like.

Megha3012_0-1641461540665.png

Each part number have the same date.

And hence, if I pivot, the dates are in the column, and I can know the quantity for each part number in an easier way.

Is there any other way to do that?

 

And I want all of this in the tablular form, and hence not using the visualisations.

 

If you don't plan on using measures and visuals, then I guess the format doesn't really matter so much but then Excel might be a better tool.

Anonymous
Not applicable

I have it in excel, but most of it done manually and hence planned on using powerBI because most of it can be automated.

Also, I am not familiar with VBA and hence using PowerBI. 

If you want to sum the total value by row, you can create a calculated column in your table with something like this:

 

NEW_COLUMN = CALCULATE(SUM(YOUR_TABLE[VALUES_COLUMN]),ALL(YOUR_TABLE))
 
And then you can add that column in your table visual, so it will show the total by row.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.