cancel
Showing results 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.

Anonymous
Not applicable

Roll back date of measure in PowerBI

Hello!

I hope it's clear what I am trying to achieve. I am basically comparing two different measures to get a market share. For example:

Phones sold by company / Phones sold by market

However what I would like is to have the same thing but moving back one of the measures, for example three months being:

Phones sold by company (six months ago) / Phones sold by market

Basically I am trying to achieve to move back the date of the first measure by six months. I am trying to use DATEADD as filter like:

CALCULATE ( Phones sold by company, DATEADD ( 'Calendar'[Date], -6, MONTH ) ) / Phones sold by market

So then any calculation I make will have this date rolled back whether I do it by months, years, etc. I believe it's wrong and should not be a filter.
I get an error saying that a function dateadd has been used in a True False expression taht is used as a table filter expression.

Thanks!
1 ACCEPTED SOLUTION
Super User

Seem fine, Just try with some other measure.

The only doubt neither the agg is used nor field is used as a measure

CALCULATE ( [Phones sold by company], DATEADD( 'Calendar'[Date], -6, MONTH ))
CALCULATE ( [Phones sold by company], datesmtd(DATEADD( 'Calendar'[Date], -6, MONTH )))

CALCULATE ( sum(Table[Phones sold by company]), DATEADD( 'Calendar'[Date], -6, MONTH ))
CALCULATE ( sum(Table[Phones sold by company]), datesmtd(DATEADD( 'Calendar'[Date], -6, MONTH )))

Check position of (  and )

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges

2 REPLIES 2
Super User

Seem fine, Just try with some other measure.

The only doubt neither the agg is used nor field is used as a measure

CALCULATE ( [Phones sold by company], DATEADD( 'Calendar'[Date], -6, MONTH ))
CALCULATE ( [Phones sold by company], datesmtd(DATEADD( 'Calendar'[Date], -6, MONTH )))

CALCULATE ( sum(Table[Phones sold by company]), DATEADD( 'Calendar'[Date], -6, MONTH ))
CALCULATE ( sum(Table[Phones sold by company]), datesmtd(DATEADD( 'Calendar'[Date], -6, MONTH )))

Check position of (  and )

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges

Anonymous
Not applicable

Apologies, I believe there was an error in my formula. Now seems to work correctly

Announcements

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

Power BI Monthly Update - April 2024

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

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors