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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
velvetine_123
Frequent Visitor

Missing subtotal - displaying as blank

Hi,

 

I have created last 12 months visual by duplicating the calendar table. Currently i have a measure with the following DAX

 

TravelSpend12M =

var _max = max('Calendar'[Date])
var _12mth = EOMONTH(_max, -12)
var results =
    IF(HASONEVALUE('Calendar (2)'[Date]) &&
        MAX('Calendar (2)'[Date]) <= _max &&
        MIN('Calendar (2)'[Date]) > _12mth ,
    CALCULATE(
        SUM('Travell'[Monthly Travel Spend]),
        FILTER(ALL('Calendar'[Date], 'Calendar'[Year], 'Calendar'[Quarter & Year]),
        'Calendar'[Date] = VALUES('Calendar (2)'[Date]) )
    ),
    BLANK()
    )
RETURN
results
 
With this DAX, i have created a matrix table displaying the monthly travel spend and date as columns. The issue is when i add another data at rows such as category, they are not displaying the group subtotal. I believe it might be due to the missing connection between the second calendar table and fact table (Travel). How can i amend the DAX to allow category to be calculated as total as well.
 
Sample table as below : 
velvetine_123_1-1723017173675.png

Date is from Calendar (2), no connection to any other tables.

Travel Category Detail is from fact table (Travel)

 

Appreciate your help in this. Thanks !


 

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

Please try something like below whether it suits your requirement.

 

TravelSpend12M =
VAR _max =
    MAX ( 'Calendar'[Date] )
VAR _12mth =
    EOMONTH ( _max, -12 )
VAR results =
    IF (
        MAX ( 'Calendar (2)'[Date] ) <= _max
            && MIN ( 'Calendar (2)'[Date] ) > _12mth,
        CALCULATE (
            SUM ( 'Travell'[Monthly Travel Spend] ),
            FILTER (
                ALL ( 'Calendar'[Date], 'Calendar'[Year], 'Calendar'[Quarter & Year] ),
                'Calendar'[Date] = VALUES ( 'Calendar (2)'[Date] )
            )
        ),
        BLANK ()
    )
RETURN
    results

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi, thanks for replying. Unfortunately it doesn't solve the problem im still not getting any column subtotal as it remains blank

Anonymous
Not applicable

Hi @velvetine_123 ,

Can you please provide example data for the table? For a matrix does not reproduce the effect of your DAX code and implementation.

 

 

Best Regards

Yilong Zhou

they are honestly a very simple table. It looks like this :

DateCategoryTravel Spend
31/7/2024Airfare$100
30/6/2024Non-Travel$50
31/5/2024Hotel$100
30/4/2024Airfare$300

 

The data model is connecting this Date to Calendar [Date]. The Calendar (2) table is an independent table with no connection.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.