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
Jodes
Helper II
Helper II

Adding date to my measure

Here is my measure:

 

Absorptions Per Month = ROUND(SUM('Data by Bedrooms'[Bedroom Sales])/6,0)

 
Absorptions per month is simply all the sales divided by months for the reporting period (6).
 
This calculates absorptions for my entire data set, but I would like to create a new measure to show only for December 31, 2018. (Q4 2018)
 
Thanks!
1 ACCEPTED SOLUTION
edhans
Super User
Super User

If you have a Dates table, it would be something along the lines of:

Absorptions Per Month =
CALCULATE (
    ROUND ( SUM ( 'Data by Bedrooms'[Bedroom Sales] ) / 6, 0 ),
    FILTER ( Dates, Dates[Month] = 12 ),
    FILTER ( Dates, Dates[Year] = 2018 )
)

Assuming your Dates table is Dates, and you have a Month and Year column in it.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
edhans
Super User
Super User

If you have a Dates table, it would be something along the lines of:

Absorptions Per Month =
CALCULATE (
    ROUND ( SUM ( 'Data by Bedrooms'[Bedroom Sales] ) / 6, 0 ),
    FILTER ( Dates, Dates[Month] = 12 ),
    FILTER ( Dates, Dates[Year] = 2018 )
)

Assuming your Dates table is Dates, and you have a Month and Year column in it.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@edhans, I don't have a date table. Is there another way to do this? Or is creating a dates table the best option?

It is the best option. 

 

You can try to do it using the built in dates table when you don't create one, but the syntax gets tedious. It would begin to look something like this:

Test = 
CALCULATE(
    SUM(Sales[Sales]),
    FILTER(Sales,[Date].[MonthNo]=1)
)

But if your Power BI model has dates, create a date table. Just make it a habit. You'll never build a model with a date table and wish you hadn't. You'll often build a model without a date table and wish you had done so from the start.

 

This article will help you quickly build a dynamic Date table for your model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thanks, appreciate it.

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.