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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
AjayRangarajan
Frequent Visitor

Need to sum the Values from one date to another date. the dates are stacked in column.

Hi All , 

It would be grateful if any one can help me with a DAX formula(Measure) for summing the column from one date to another for each line item as the dates are all stacked as headers. i have added the screen shot , so what i need is to sum the ETC hours for the column from 2nd May to 13 june 20. Thanks in advance for your help.

 

AjayRangarajan_0-1597564630355.png

 

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

Power BI is designed to work in columns, not rows.

So I recommend you click Transform Data from the Home tab and Unpivot the dates. To make this work for future data updates (as the date column headings change), I recommend you select all the NON date columns (in your screenshot this would mean you must select [Level], [ETC Hours], and any of the columns to the left that aren't in your screenshot).
Once you have selected these columns, click the Transform tab from within the Power Query Editor, then select Unpivot Other Columns. You will be left with ETC Hours, Level, Attribute and Value. Rename these if you wish.
Close & Apply your changes.
Then you can put the [Value] column (or whatever you renamed it to) in a visual in the Values and filter by date, level, etc.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

1 REPLY 1
AllisonKennedy
Super User
Super User

Power BI is designed to work in columns, not rows.

So I recommend you click Transform Data from the Home tab and Unpivot the dates. To make this work for future data updates (as the date column headings change), I recommend you select all the NON date columns (in your screenshot this would mean you must select [Level], [ETC Hours], and any of the columns to the left that aren't in your screenshot).
Once you have selected these columns, click the Transform tab from within the Power Query Editor, then select Unpivot Other Columns. You will be left with ETC Hours, Level, Attribute and Value. Rename these if you wish.
Close & Apply your changes.
Then you can put the [Value] column (or whatever you renamed it to) in a visual in the Values and filter by date, level, etc.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors