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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
vishbad
Frequent Visitor

Show last N months based on FiscalYearMonth slicer selection without calendar/date table

My requirement

Ex-1 When the user select a value say 202501 from slicer "FiscalYearPeriodCd" which is a text data type. The table below should display last 13 months . Ie from 202401 to 202501. ---Last 13 months

Ex-2 When the user selects "202411" , the table below should display SalesUSD from 202311 to 202411 .---Last 13 months.

 

.Unfortunately i have a calendar table but the calendar table and fact table are related using someother key and not a datekey as per the business requirement and hence i cannot change it.Also in my date table , i have the date repeated twice.One is for US and another for Non US due to fiscal calculation.Hence i cannot use datesinperiod , dateadd or other date related functions.Hence the only option is to use FiscalYearPeriodCd.

 

Raw data below 

SalesUSDFiscalYearPeriodCd
534132759.5202201
1557801979202202
695221259.1202203
813135024.7202204
832097591.8202205
755491149.2202206
848978369.6202207
831567295.5202208
907314200.6202209
822103615.4202210
674213875.8202211
-2879970782202212
859510773.8202301
908174754.8202302
856401757.6202303
864263784202304
880142006.9202305
861088774.2202306
-2353615032202307
968984985.4202308
-1857687494202309
868514132.3202310
-66961618.2202311
1317854317202312
1060522633202401
1011795775202402
829441979.7202403
1100402094202404
1064195484202405
1138271467202406
1898901.5202407
754629775202408
130722055.9202409
1437834704202410
912161100.4202411
167628959.9202412
486353211.6202501
98759203.23202502

 

 

Expected output for Ex 1 slicerselection = 202501

MgmtRateUSDFiscalYearPeriodCd
1060522633202401
1011795775202402
829441979.7202403
1100402094202404
1064195484202405
1138271467202406
1898901.5202407
754629775202408
130722055.9202409
1437834704202410
912161100.4202411
167628959.9202412
486353211.6202501

 

expected output  for ex 2 - slicerselection = 202411

MgmtRateUSDFiscalYearPeriodCd
-66961618.2202311
1317854317202312
1060522633202401
1011795775202402
829441979.7202403
1100402094202404
1064195484202405
1138271467202406
1898901.5202407
754629775202408
130722055.9202409
1437834704202410
912161100.4202411

 

 

Thank you so much in advance.

1 ACCEPTED SOLUTION

ThxAlot_0-1740964532994.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



View solution in original post

(Virus scan in progress ...)
3 REPLIES 3
vishbad
Frequent Visitor

HI @ThxAlot 

 

i had the same thought where usually calendar and fact are related using date table.

In my scenarios the data modelling is taken care by another team so they have made a different relation for some reason.

ThxAlot_0-1740964532994.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



(Virus scan in progress ...)
ThxAlot
Super User
Super User

Funny that a calendar table isn't connected to fact table by a date column; then what's the point of a calendar ... Use a knife to hammer a nail?



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



Helpful resources

Announcements