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.
Hi,
in power bi desktop I have
1)following dataset which is calculating amount for each quarter means from January to March,April to June,July to September and October to December.
select datepart(QUARTER, entrydate_inrevenue) revenuequarter
,sum(amount)Amount
from Accounts
where
datepart(year, entrydate_inrevenue) = datepart(year,getdate())
group by datepart(QUARTER, entrydate_inrevenue)
But For my report I need to calculate cumulative values from january to March,January to June,January to September,January to December.which means from starting of year to end of each quarter.
I also have dimdate table in my database.
Can someone please explain how to implement this.
Thanks.
Solved! Go to Solution.
hi, @kan
After my research, you could try this way as below:
Add a Quarter NO column for date table
Quarter NO = INT ( FORMAT ( [Date], "q"))
Step2:
Add a measure by this formula
result = CALCULATE ( SUM ( 'Table'[Amount] ), FILTER ( ALL ( 'Date' ), AND ( 'Date'[Quarter NO] <= MAX ( 'Date'[Quarter NO] ), YEAR ( 'Date'[Date] ) = YEAR ( TODAY () ) ) ) )
Result:
here is pbix, please try it.
Best Regards,
Lin
hi, @kan
After my research, you could try this way as below:
Add a Quarter NO column for date table
Quarter NO = INT ( FORMAT ( [Date], "q"))
Step2:
Add a measure by this formula
result = CALCULATE ( SUM ( 'Table'[Amount] ), FILTER ( ALL ( 'Date' ), AND ( 'Date'[Quarter NO] <= MAX ( 'Date'[Quarter NO] ), YEAR ( 'Date'[Date] ) = YEAR ( TODAY () ) ) ) )
Result:
here is pbix, please try it.
Best Regards,
Lin
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |