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
rane19
Helper I
Helper I

Current YTD vs Last Month YTD Power BI Measure

Goal:

  • 1 - show the change of every month compare with last YTD in the table form in only selected year
  • 2 - show the change in scorecard

Data :

ind YEAR    MON Figures
1   2020    JAN 12321
2   2020    FEB 344
3   2020    MAR 5000
4   2020    APR 325
5   2020    MAY 747
1   2019    JAN 54091
2   2019    FEB 349
3   2019    MAR 789
4   2019    APR 901
5   2019    MAY 2356

Desire Result:

  • YTD column is accumulating Figures within the year
  • Change column is showing the change compare to last month YTD

Usage - Default filter as newest year = 2020 , user can select the specific single year to view the change in scorecard

ind YEAR    MON Figures YTD     Change
1   2020    JAN 12321   12321   0
2   2020    FEB 344     12665   344
3   2020    MAR 5000    17665   5000
4   2020    APR 325     17990   325
5   2020    MAY 747     18737   747
1   2019    JAN 54091   54091   0
2   2019    FEB 349     54440   349
3   2019    MAR 789     55229   789
4   2019    APR 901     56130   901
5   2019    MAY 2356    58486   2356

How can i achieve this ?

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @rane19 ,

 

Check the measures.

Measure = CALCULATE(SUM('Table'[Figures]),FILTER(ALLSELECTED('Table'),'Table'[YEAR]=SELECTEDVALUE('Table'[YEAR])&&'Table'[ind]<=MAX('Table'[ind])))

Measure 2 = 
var lastmonth = CALCULATE(SUM('Table'[Figures]),FILTER(ALLSELECTED('Table'),'Table'[YEAR]=SELECTEDVALUE('Table'[YEAR])&&'Table'[ind]<=MAX('Table'[ind])-1))
return
IF(ISBLANK(lastmonth),0,[Measure]-lastmonth)

Result would be shown as below.

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @rane19 ,

 

Check the measures.

Measure = CALCULATE(SUM('Table'[Figures]),FILTER(ALLSELECTED('Table'),'Table'[YEAR]=SELECTEDVALUE('Table'[YEAR])&&'Table'[ind]<=MAX('Table'[ind])))

Measure 2 = 
var lastmonth = CALCULATE(SUM('Table'[Figures]),FILTER(ALLSELECTED('Table'),'Table'[YEAR]=SELECTEDVALUE('Table'[YEAR])&&'Table'[ind]<=MAX('Table'[ind])-1))
return
IF(ISBLANK(lastmonth),0,[Measure]-lastmonth)

Result would be shown as below.

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Amazing , it is exactly what i wanted.

amitchandak
Super User
Super User

@rane19 , My advice would be create a date table and join it with DAte table and use time intelligence

 

New column

Date = "01-" & [Month] & "-" & [year] // change Data type to date

 

measures


YTD Sales = CALCULATE(SUM(Table[Figures]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Table[Figures]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

diff = [YTD Sales] -[Last YTD Sales]

 

change = [YTD Sales] -SUM(Table[Figures])

 

Appreciate for the answer but what I am looking for is the accumulated total of Figures within each year at "YTD" column and the change (growth or drop) compare with last month's total and current month's total . Proposed answer looks Year to Year comparison

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.