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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
THENNA_41
Post Partisan
Post Partisan

current date year and compare same date previous year divide

 is there any  option to compare current date year and same date year  previous year 

 

I have current date  September 15,2021  . i want to compare same as previous year septemer 01,2021 exactly one year beofer 

 

 

Data :

Period                         Revised closing value

01 sep 2020                              45

....                                              .....

...                                              .....

15 sep 2021                            56

 

i have created measure but i am getting blank value .

 

%Prvs = VAR LastMAXDate = MAX ( Data[Period] )
var currentvalue = CALCULATE (
SUM ( Data[Revised closing value] ),
Data[Period] = LastMAXDate
)
var prvsyear =
CALCULATE (
SUM ( Data[Revised closing value] ),
Data[Period] = LastMAXDate-365
)
return DIVIDE((currentvalue-prvsyear),prvsyear)
 
 
i am looking for  support.   Thanks in advance

 

 

1 REPLY 1
BeaBF
Impactful Individual
Impactful Individual

@THENNA_41 Try this:

 

%Prvs =
var maxxx = CALCULATE(MAX(Data[Period]), ALLSELECTED(Data[Period]))
var actual = CALCULATE(SUM(Data[Revised closing value]), Data[Period] = maxxx)
var prevmm = CALCULATE(SUM(Data[Revised closing value]), DATEADD(Data[Period], -1, YEAR))
var num = actual - prevmm

RETURN (num / prevmm)
 
Also, when creating this measure, be sure to select "decimal value" and choose 3 decimal places. Box in red:
pbi_comm_3.png
 
B.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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