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
Anonymous
Not applicable

Financial year cumulative on FY month slicer

 

Hi,
I am trying to get the financial year cumulative value on month selection.
On selection of particular month on slicer dropdown, FY Year month cumulative value has to get
Month slicer is sorted on Financial year wise (April to March)

All tables are related to a date field, By using date I created Fy Date, FyMonth, FyYear fields,
All Calculations are created based on FY Date.forum.PNG
I am achieving this cumulative by using the Fy Month range slicer.
I want to achieve this on month selection dropdown, like if I select June month -> April + may + June values

Month SLicer (Dropdown)
-------------
->April, May, June...March
---------------------------

-------------------------------------------------------------------------------
Below is the formula I am using
--------------------------------------------------------------------------------
TestMDBaseFYear = var p =SWITCH(SELECTEDVALUE(date_dim[month_name]),"August",5,"December",9,"July",4,"November",8,"October",7,"September",6,
"April",1,"February",11,"January",10,"March",12,"May",02,"June",3)
var year=SELECTEDVALUE(date_dim[FY Date].[Year])
var start1=DATE(SELECTEDVALUE(date_dim[FY Date].[Year]),"01","01")
var end1=DATE(SELECTEDVALUE(date_dim[FY Date].[Year]),p, MAX(date_dim[FY Date].[Day]))

return
// CONCATENATE(start1,end1)
IF(SELECTEDVALUE(date_dim[FY Date].[Year]) <> BLANK(),
CALCULATE(SUM(WHOLSALE_DUMP[GWP_IN_MNS_]),
//DATESBETWEEN(date_dim[FY Date].[Date],start1,end1)
FILTER(ALLEXCEPT(date_dim,date_dim[FY Date].[Year]),date_dim[Fy Date].[Date]>=start1 &&
date_dim[Fy Date].[Date]<=end1)
),0)
--------------------------------------------------------------------------------------

Please give any solution for this.

 

Thanks
Dileep

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

Hi  @Anonymous  ,

The filter in the last formula of your function should be WHOLSALE_DUMP, because you want to calculate the GWP_IN_MNS of this table

Some data I created:

Table date_dim:

v-yangliu-msft_0-1620621468144.png

Table WHOLSALE_DUMP:

v-yangliu-msft_1-1620621468157.png

Here are the steps you can follow:

1. Create measure.

Measure =
var _p =
SWITCH(
    SELECTEDVALUE(date_dim[month_name]),
    "August",5,"December",9,"July",4,"November",8,"October",7,"September",6,
    "April",1,"February",11,"January",10,"March",12,"May",02,"June",3,1)
var _year=SELECTEDVALUE('date_dim'[Year])
var _start1=DATE(_year,"01","01")
var _end1=DATE(_year,_p, MAX('date_dim'[Day]))
return
IF(_year<>BLANK(),CALCULATE(SUM(WHOLSALE_DUMP[GWP_IN_MNS]),FILTER('WHOLSALE_DUMP',YEAR([Date])=_year&&[Date]>=_start1&&[Date]<=_end1)),0
)

2. Result:

v-yangliu-msft_2-1620621468160.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

The filter in the last formula of your function should be WHOLSALE_DUMP, because you want to calculate the GWP_IN_MNS of this table

Some data I created:

Table date_dim:

v-yangliu-msft_0-1620621468144.png

Table WHOLSALE_DUMP:

v-yangliu-msft_1-1620621468157.png

Here are the steps you can follow:

1. Create measure.

Measure =
var _p =
SWITCH(
    SELECTEDVALUE(date_dim[month_name]),
    "August",5,"December",9,"July",4,"November",8,"October",7,"September",6,
    "April",1,"February",11,"January",10,"March",12,"May",02,"June",3,1)
var _year=SELECTEDVALUE('date_dim'[Year])
var _start1=DATE(_year,"01","01")
var _end1=DATE(_year,_p, MAX('date_dim'[Day]))
return
IF(_year<>BLANK(),CALCULATE(SUM(WHOLSALE_DUMP[GWP_IN_MNS]),FILTER('WHOLSALE_DUMP',YEAR([Date])=_year&&[Date]>=_start1&&[Date]<=_end1)),0
)

2. Result:

v-yangliu-msft_2-1620621468160.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Yon can use time intelligence and date table

 

example

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"3/31")) // year will end on 3/31 means start date is 4/1 
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"3/31"))

 

with month no , year

 

YTD= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Month] <= Max('Date'[Month]) ))
LYTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Month] <= Max('Date'[Month])))

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

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.