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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
simaotc
Frequent Visitor

Stange behaviour of calculation groups

Hello dear comunity,

 

I have a financial dashboard with two main tables.

 

A date table and a table with all accounting movements, including movements between companies of the group.

 

First, I createt a calculation group for dynamic periods, like QTD, YTD, Last 6 Months, ...

This is the base code:

VAR _datetable = 'Date'
VAR _today = TODAY()
VAR _month = MONTH(TODAY())
VAR _quarter = QUARTER(TODAY())
VAR _year = YEAR(TODAY())
VAR _thisquarterstart = DATE(_year, SWITCH(TRUE(), _quarter = 1,1, _quarter=2,4, _quarter=3,7,10) ,1)
VAR _previousquarterstart = EDATE(_thisquarterstart, -3) // New variable for the start of the previous quarter
VAR _thisyearstart = DATE(_year,1,1)


VAR _QTD = FILTER('Date','Date'[Date]<=_today && 'Date'[Date] >= _thisquarterstart)

VAR _YTD = FILTER('Date','Date'[Date]<=_today && 'Date'[Date] >= _thisyearstart)

VAR _PreviousQuarter = FILTER('Date','Date'[Date] < _thisquarterstart && 'Date'[Date] >= _previousquarterstart)

VAR _Last6Months = FILTER('Date','Date'[Date]>_today-181)

VAR _Last12Months = FILTER('Date','Date'[Date]>_today-366)



RETURN
CALCULATE ( SELECTEDMEASURE(), _Last6Months )


It filters in both table but in the table of the previous year stops doing the YTD:

simaotc_0-1702860601714.png

 

The second question is about the aggregated transactions between companies, for that I created another calculation group, where the user can select the company A, company B and movements between Company A - Company B (all movements of company A + all movements of company B - movements between the two companies):


VAR _A = FILTER('Movements','Movements'[Company] = "A")

VAR _B = FILTER('Movements','Movements'[Company] = "B")

VAR _A_B = 
FILTER(
    'Movements',
    ('Movements'[Company] = "A" || 'Movements'[Company] = "B") &&
    ('Movements'[InterCo] <> "A-B")
)
RETURN
CALCULATE ( SELECTEDMEASURE(), _A )



But This doesn't work - both tables I got monthly values and all the values in second table are equal to the first table:

simaotc_1-1702861223154.png

 

I know it's confusing but any help would be incredibly appreciated

 

Thank you,

Simao

 

 

1 REPLY 1
amitchandak
Super User
Super User

@simaotc , The calculation group do not seem fine to me refer how the time based and other meausre based calculation groups are created and used

 

Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0

 

Model explorer public preview with calculation group authoring| Measure Slicer: https://youtu.be/VfxfJJ0RzvU

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors