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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
banditto
New Member

DAX formula

Hi

I am begginer with Power BI, and I need DAX formula for this. I have one table , in this table I have columns Lectures per year and Examples per year. I want to create new column where I wanna have SUM both columns per week. Thanks for answers.

2 REPLIES 2
kcantor
Community Champion
Community Champion

You will need a date table. Add  your date then add a calculated week number and year column to the date table. All dates must be included.

Then, in your sales table do two separate sums first (in case you need the separated next time)>

Total 1 = SUM('Sales Table'[First Column])

Total 2 = SUM('Sales Table'[Second Column])

Combined Total = [Total 1] + [Total 2]

 

This assumes the table is named 'Sales Table' and the columns you want to add are called [First Column] and [Second Column] for simplicity.

Then, using your date table and the sales table build the visualization by adding week number and combined total. You will probably want a year slicer as well if you have more than one years worth of data.

Or, you can cross over the year mark by adding a combined Year-Week to the date table by doing a simple calculated column such as Year-Week = [Year]&"-"&FORMAT([WeekNumber], "00") to get 2016-01, 2016-02, ect.

Of course this assumes that your sales table (or fact table) has a date assigned and not just a year. You really cannot easily break down the fact table by week unless there is a specific date assigned within the data.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




austinsense
Impactful Individual
Impactful Individual

Hey you should create another table called "Calendar" that will include at least two columns - [Date] & [Week].  The dates need to be contiguous, meaning don't skip any dates - you can then join this Calendar table to the current table you have.

Austin is VP Operations at PowerPivotPro and a professional self-service enthusiast 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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