Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hi,
I've been experimenting with calculation groups, and I was wondering wether it is possible to use a member of a calculation group to calculate a new member. For example, when calculating YTD and YTD previous year (PY), I normally would use the following formulas:
Sales YTD = TOTALYTD(Sum('Sales'[Revenue]),'Date'[Date]) Sales LY YTD = CALCULATE ([Sales YTD], SAMEPERIODLASTYEAR ('Date'[Date]))
But I'm not sure how to use the same logic when using calculation groups. Is there a way to reference a member of a calculation group (in this case, YTD) when calculating a new member (YTD PY)?
Thanks in advance!
Best,
Eva
Solved! Go to Solution.
@E__ , Make sure Date/calendar table is marked as "Date" Table. Tight click on the table in Field pane, there is an option mark as date table
You can also try these options
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Thanks for the advice. I've now put more time into understanding calculation groups, and followed SQLBI's "Mastering DAX video course" on calculation groups as well. As you suggested, I won't use recursion. I find it strange that the Microsoft documentation on calculation groups (https://docs.microsoft.com/en-us/analysis-services/tabular-models/calculation-groups?view=asallprodu...) (https://docs.microsoft.com/en-us/analysis-services/tabular-models/calculation-groups?view=asallprod...) simply mentions that you can use sideways recursion without mentioning any of the "dangers".
Best,
Eva
@E__ , Make sure Date/calendar table is marked as "Date" Table. Tight click on the table in Field pane, there is an option mark as date table
You can also try these options
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
User | Count |
---|---|
11 | |
9 | |
6 | |
5 | |
4 |