The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am still new to DAX. I have a table that contains general ledger account transactions: account number, date, value. I also have a date table. the fiscal year starts on May 1st, ends on April next calendar year (12 fiscal period). For each gl account, there is an opening balance on May 1st. At last day of each month, there is an amount representing the total change of the month.
Now I want to calculate the average balance over the past 12 fiscal period. Trick part is at first I need to create a measure that calculates the ending balance at each fiscal period. I was able to create that:
Accumu_Balance = CALCULATE ( SUM ( Trsansactions[Value] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
Total_Trailing12Period = CALCULATE ( [Accumu_Balance], DATESINPERIOD ( 'Date'[Date], LASTDATE ( 'Date'[Date] ), -12, MONTH ) )
Solved! Go to Solution.
Hi,
You may download my PBI file from here.
Hope this helps.
First time to use drop box...below are the link to the files, first contains the excel file and expected result.
second is the pbix file.
Thanks,
https://www.dropbox.com/s/vsbk5hqxzvagtbd/BI%20Files.xlsx?dl=0
https://www.dropbox.com/s/sixqiwshxpzriep/trailing12Period_Balance.pbix?dl=0
Hi,
You may download my PBI file from here.
Hope this helps.
Hi Ashish,
I have been looking for an answer to my PBI problem and it looks like you were solving here the same kind of dilemma that I'm having at the moment. But I could't get the material you had posted here years back. Any chances to repost it or something like that?
Kind regards,
Mirja A.
Hi,
I do not have that file now. Share some data (in a format that can be pasted in an SM Excel file), explain the question and show the expected result.
Hi,
I just found the pbix in a post down below. 🙈 Someone else had asked for it. I'll take a look at it first and get back to you with more info if the pbix doesn't solve my problem.
Regards,
Mirja
I am looking something similar, Could you upload the pbix file here as I am not able to open one drive else let me know how you solved this problem.
Thanks in advance.
I am facing bit different problem, kindly guide me on this
1. Suppose if user select Dec'21 in slicer, then the data will filter out as described below:
In start date column data would be selected less than equal to user selection that is <=Dec'21 and in end date selection would be greater than equal to user selection >-Dec'21.
which I can get by below measure:
Kindly suggest. Thanks in advance.
Hi,
See if my solution here helps - Flex a Pivot Table to show data for x months ended a certain user defined month.
With the MS Excel file closed, open PowerBI Desktop and go to Import > Power Query, PowerPivot and Power View. The DAX formulas and tables will now appear in the PBI file. Please study the solution.
That's amazing Ashish! works like a charm! thanks so much!
I am so impressed by the techniques you applied here!
atad
You are welcome. Thank you for your kind words.
Hi @atad
You may try below measure and drag Year and Month column into the visual.
Total_Trailing12Period = CALCULATE ( SUM ( Trsansactions[Value] ), DATESINPERIOD ( 'Date'[Date], LASTDATE ( 'Date'[Date] ), -12, MONTH ) )
Regards,