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
Anonymous
Not applicable

Measure(s) for quarterly sales for a fact table with end and start date that crosses multiple Q's

Hi All,

 

I am trying to calculate quarterly sales through a measure. The fact table has a start date and an end date which crosses multiple quarters and sometimes multiple years. An example of the data is as follows:

 

Table of the data model in PowerBI.JPG

 

 

 

 

 

 

I am using a separate date table with dates listed from 01-01-2019 to 31-12-2020 which includes a column for quarters of a year (Q1 2019, Q2 2019 etc). The start date of the fact table above is connected with the date columns of the date table.

The data spans across too many years to create (many) calculated columns in the fact tabel (a few columns would be ok though if really needed). Therefore a measure is needed in this case.

 

Which measure(s) would calculate quarterly sales in a table in the report view in PowerBI to get this result:

 

Required end result - table through a measure with quarterly sales.JPG

 

 

 

 

 

 

 

 

 

 

PS because of the confidentiality of the real data in PowerBI, the tables shown here have been made in Excel.

Thank you ver y much for your help.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , I have disributed a similar kind of data and used that. See if the file attached after the signature can help you.

 

I have used only month in the calendar, you can use quarter

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , I have disributed a similar kind of data and used that. See if the file attached after the signature can help you.

 

I have used only month in the calendar, you can use quarter

Anonymous
Not applicable

@amitchandak: can you please explain, why the 'Data'[id] column in there?

Anonymous
Not applicable

PS for other readers: I used the date table blelow and connected the [date] from this table to the date table from the solution given. Then I just dragged and dropped the "YearQuarter" in the table in the reports view which gives the desired result.

Date tabel =
ADDCOLUMNS (
CALENDAR (DATE(2019,1,1), DATE(2020,12,31)),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"YearQuarter", "Q" & FORMAT ( [Date], "Q" ) & "/"& FORMAT ( [Date], "YYYY" )
)

Anonymous
Not applicable

Great, this was exactly what I needed, thank you!

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.

Top Solution Authors