The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi, I'am new to power BI and Dax queries and I want to calculate a cumulative sum for each month starting from the 01/01 of each year.
Example : For period1 of 2023 => Sum starting from 01/01/2023 until the 31/01/2023
For period2 of 2023 => Sum starting from 01/01/2023 until the 28/02/2023 (So Sum of period1 + Period 2)
etc ...
For period12 of 2023 => Sum starting from 01/01/2023 until the 31/12/2023 (So Sum of period1 + Period 2 + Perdiod3 + ... + Period12 )
I tried the following :
DebitExercice = CALCULATE(sum('General ledger attributes'[PRIMARYAMOUNT]), 'General ledger attributes'[ISCREDIT] = "No",
FILTER(
ALLSELECTED('Fiscal periods'[Date],'Fiscal periods'[Fiscal year],'Fiscal periods'[Period Month]),'Fiscal periods'[Date] >= DATE('Fiscal periods'[Fiscal year],01,01) && 'Fiscal periods'[Date] <= date('Fiscal periods'[Fiscal year],'Fiscal periods'[Period Month],DAY(EOMONTH('Fiscal periods'[Date],0)))))<br /><br /><li-code lang="markup">DebitExercice = CALCULATE(sum('General ledger attributes'[PRIMARYAMOUNT]), 'General ledger attributes'[ISCREDIT] = "No", FILTER( ALLSELECTED('Fiscal periods'[Date],'Fiscal periods'[Fiscal year],'Fiscal periods'[Period Month]),'Fiscal periods'[Date] >= DATE('Fiscal periods'[Fiscal year],01,01) && 'Fiscal periods'[Date] <= date('Fiscal periods'[Fiscal year],'Fiscal periods'[Period Month],DAY(EOMONTH('Fiscal periods'[Date],0)))))
Solved! Go to Solution.
Hi @Safus09 ,
Assuming you have separate dates table with FY info, try the following
Total Transactions YTD FY2 =
CALCULATE ( [Total Transactions], DATESYTD ( Dates[Date], "Jun 30" ) )
Transactions YTD FY =
CALCULATE (
[Total Transactions],
FILTER (
ALL ( Dates ),
Dates[Date] <= MAX ( Dates[Date] )
&& Dates[FY] = MAX ( Dates[FY] )
)
)
Please see attached pbix for details.
Hi @Safus09 ,
Assuming you have separate dates table with FY info, try the following
Total Transactions YTD FY2 =
CALCULATE ( [Total Transactions], DATESYTD ( Dates[Date], "Jun 30" ) )
Transactions YTD FY =
CALCULATE (
[Total Transactions],
FILTER (
ALL ( Dates ),
Dates[Date] <= MAX ( Dates[Date] )
&& Dates[FY] = MAX ( Dates[FY] )
)
)
Please see attached pbix for details.
DebitExercice = CALCULATE(sum('General ledger attributes'[PRIMARYAMOUNT]), 'General ledger attributes'[ISCREDIT] = "No",
FILTER(
ALLSELECTED('Fiscal periods'[Date],'Fiscal periods'[Fiscal year],'Fiscal periods'[Period Month]),'Fiscal periods'[Date] >= DATE('Fiscal periods'[Fiscal year],01,01) && 'Fiscal periods'[Date] <= date('Fiscal periods'[Fiscal year],'Fiscal periods'[Period Month],DAY(EOMONTH('Fiscal periods'[Date],0)))))
Sorry I don't know how to modify a post, so I repost the corrected used code.
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |