cancel
Showing results for 
Search instead for 
Did you mean: 
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
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.