cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Helper I

## Calculate Sum on a Weekday basis fails on a Monthly and Yearly display

I'm using 2 Tables for this, Calendar and Plan.

Calendar has the usual:

 Date Year MonthNum Month Weekday Day Week DayOfYear Sunday, January 1, 2023 2023 1 jan 6 1 1 1 Monday, January 2, 2023 2023 1 jan 0 2 2 2 Tuesday, January 3, 2023 2023 1 jan 1 3 2 3 ...

Calendar = calendar(date(2023,1,1),date(2024,12,31))
Year = YEAR('Calendar'[Date])
MonthNum = MONTH('Calendar'[Date])
Month = FORMAT('Calendar'[Date],"mmm")
Weekday
= WEEKDAY(Calendar[Date],3) /* option 3 gives 0 = Monday, 1 = Tuesday, ...
Day = DAY(Calendar[Date])
Week = WEEKNUM('Calendar'[Date],2)
DayOfYear = FORMAT([Date], "Y")

Plan assigns an Amount for an Id on a given Weekday:
 Id Amount Weekday 1 1 0 1 1 1 1 1 2 1 1 3 1 1 4 1 1 5 1 1 6 2 3 0 2 3 1 2 3 2 2 3 3 2 3 4 2 3 5 2 3 6 3 8 0 3 8 2 3 8 4 4 6 0 4 6 2 4 6 4 5 11 5 5 11 6 6 9 1 6 9 3

The relationship I'm using between tables for now is Weekday - Weekday (a many to many, as you can imagine).

The measure for now is:
TotalAmount = CALCULATE(SUM(Plan[Amount]))

So, the thing is, if I display a Matrix for TotalAmount by Id against Date works fine on a daily or weekly basis but fails for month and year totals, it looks as following:

How would you go about getting it right also on a monthly and yearly basis?

Do I need to adjust TotalAmount measure?

2 REPLIES 2
Super User

@poweringthru , Does your second table has a date ? why do you need populate weekday to ID?

can you make sure your date to join(calendar date and fact date) is correct? Because if the data is correct at the date of the calendar, it should rollup correctly

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Helper I

Plan table is Weekday driven, rows don't have a specific date. I need it to apply to any given month and year.

Here is a test pbix document in a WeTransfer link:

https://we.tl/t-2kioURKTvH

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors