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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
ax80
New Member

USERELATIONSHIP WITH PREVIOUS YEAR DATE

Hi all,

I'm using USERELATIONSHIP in a formula with dates and I need to substitute year of selected dates with previous year.

Dates are used a slicer on the page with yerarchy Year/Quarter/Month.

 

My current formula is this:

Amount =
CALCULATE(SUM(Table[Amount]);
USERELATIONSHIP('Date'[Date];Table[Document date]))
 

Any suggestion?

Thanls

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ax80 , Try like. Keep USERELATIONSHIP inside

CALCULATE( CALCULATE(SUM(Table[Amount]);
USERELATIONSHIP('Date'[Date];Table[Document date])) ,DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

or

 

CALCULATE(CALCULATE(SUM(Table[Amount]);
USERELATIONSHIP('Date'[Date];Table[Document date])),previousyear('Date'[Date]))

View solution in original post

2 REPLIES 2
Kidata
Regular Visitor

Try this:

CALCULATE(CALCULATE(SUM(Table[Amount]);

USERELATIONSHIP('Date'[Date];Table[Document date])),

SAMEPERIODLASTYEAR('Date'[Date]))


amitchandak
Super User
Super User

@ax80 , Try like. Keep USERELATIONSHIP inside

CALCULATE( CALCULATE(SUM(Table[Amount]);
USERELATIONSHIP('Date'[Date];Table[Document date])) ,DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

or

 

CALCULATE(CALCULATE(SUM(Table[Amount]);
USERELATIONSHIP('Date'[Date];Table[Document date])),previousyear('Date'[Date]))

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors