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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
TR_TD
Regular Visitor

DAX calculated measure only working in a specific row before any FILTER is applied

Hi, I have been unable to figure out the following issue:

  • I cannot calculate measures in my total (calculated) rows (i.e Total = Measure 1 + Measure 2) of my Expense statement Layout template because Measure 1 (or Measure 2) is only calculated in it's own row and the Total row stays blanks (See Screenshot#1).
  • The measure calculations do not work when I use my RM Expense Layout table (using formula #1 or #2)  
  • The measure calculations work if I use the (sub)header column (Group Level 2 (CALC) from my CC Mapping Table (equivalent to a Chart of Accounts) with Formula #1

My question is: How can I make the result in screenshot #2 work with my RM Expense Layout table? Why are the measures only working as inteded with the [GROUP Level 2 (CALC)] column table layout?

 

Below, shows the relationships between my tables

TR_TD_0-1748370142530.png

Formula #1: NFRM = CALCULATE(

    SUM('06. Hyperion Data (GL)'[Amount]),

    '03. CC Mapping'[Group Level 2 (CALC)]="Non-Financial Risk."

)

Formula #2:

    SUM('06. Hyperion Data (GL)'[Amount]),

    '05. RM Expense Layout'[RM Expense Layout]="Non-Financial Risk."

)

 

Screenshot #1:

  • The calculated the NFRM measure only works for the header that matches the text in Group Level 2 (CALC) column (CC Mapping table) or the text from the RM Exp Layout column in the RM Expense Layout table.

 

TR_TD_1-1748370142532.png

Screenshot #2:

  • Measure works in all the rows before any filter is applied.
  • With formula #2, calculation only happens in Non-Financial Risk row.

 

1 ACCEPTED SOLUTION

Hi, I was able to get some help from a colleague and the following solution worked to remove filtering from the CC Mapping table which was causing the issue when I used the RM Expense Layout column:

 

VAR _NFRM =
    CALCULATE(
        [Amounts],
        '05. RM Expense Layout'[RM Expense Layout] = "Non-Financial Risk.",
        REMOVEFILTERS( '03. CC Mapping' )
    )
 
VAR _Result =
SWITCH(
    SELECTEDVALUE('05. RM Expense Layout'[RM Expense Layout]),
    "FCRM projects.", _FCRM,
                [Amounts]
                )
RETURN
    _Result

View solution in original post

10 REPLIES 10
techies
Solution Sage
Solution Sage

Hi @TR_TD please share the sample pbix file if possible

― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978
v-karpurapud
Community Support
Community Support

Hi @TR_TD 


Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thank you @Alex_Sawdo for your helpful response.
 

Regarding your query on creating a subtotal in your RM Expense Layout matrix using DAX logic:
 

While I’m not fully aware of the exact structure of your full dataset, I’ve created a sample .pbix file to demonstrate one possible solution that aligns with your goal of making calculated totals appear correctly using the RM Expense Layout table.

Try the below DAX to compute subtotal values correctly in your matrix visual:

NFRM_Mapped_Amount = 
VAR SelectedLayout = SELECTEDVALUE('RM_Expense_Layout'[RM Expense Layout])
RETURN
SWITCH(
    TRUE(),
    SelectedLayout = "Non-Financial Risk.",
        CALCULATE(
            SUM('Hyperion_Data_GL'[Amount]),
            'CC_Mapping'[Group Level 2 (CALC)] = "Non-Financial Risk."
        ),
    SelectedLayout = "Operations",
        CALCULATE(
            SUM('Hyperion_Data_GL'[Amount]),
            'CC_Mapping'[Group Level 2 (CALC)] = "Operations"
        ),
    SelectedLayout = "Technology",
        CALCULATE(
            SUM('Hyperion_Data_GL'[Amount]),
            'CC_Mapping'[Group Level 2 (CALC)] = "Technology"
        ),
    SelectedLayout = "Total",
        CALCULATE(SUM('Hyperion_Data_GL'[Amount])),
    BLANK()
)

I’ve attached a screenshot and the .pbix file demonstrating this logic. Please review them to see if this approach meets your reporting requirements.

vkarpurapud_0-1748414398973.png

 

 

If this doesn’t fully meet your needs, could you kindly share a sample of your data and more detailed context? That would help us provide a more accurate solution.
 

 

If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.

 

 

Thank You!

Hi @v-karpurapud , thank you very much for your response. Unfortunately, the issue is still there and my Total row is still bank/doesn't pick up the created measures.

TR_TD_0-1748460702876.png

Here is my data set/source (altered):

 

1) 05. RM Expense Layout

RM Expense SectionLayout OrderHighlightRM Expense Layout
Group 1 - Header 110Group 1 - Header 1
Group 1 - Header 220Group 1 - Header 2
Group 1 - Header 330Group 1 - Header 3
Group 1 - Header 440Group 1 - Header 4
Group 1 - Header 550Group 1 - Header 5
Group 1 - Non-Financial Risk Management60Group 1 - Header 6
Group 1 - Header 770Group 1 - Header 7
Group 1 Total81Group 1 Total
Group 2 - Header 190Group 2 - Header 1
Group 2 - Header 2100Group 2 - Header 2
Group 2 - Header 3110Group 2 - Header 3
Group 2 Total121Group 2 Total

 

2) 03. CC Mapping 

CC FullGroup Level 1Group Level 2 (CALC)Calculation TypeOperator (+ or -)Order Group level 1Order Group level 2
Cost_Centre1Group 1  - SubHeader1Group 1 - Header 1Data - Line item111
Cost_Centre2Group 1  - SubHeader1Group 1 - Header 1Data - Line item111
Cost_Centre3Group 1  - SubHeader1Group 1 - Header 1Data - Line item111
Cost_Centre4Group 1  - SubHeader1Group 1 - Header 1Data - Line item111
Cost_Centre5Group 1  - SubHeader1Group 1 - Header 1Data - Line item111
Cost_Centre6Group 1 - Subheader 2Group 1 - Header 2Data - Line item132
Cost_Centre7Group 1 - Subheader 2.1Group 1 - Header 2Data - Line item132
Cost_Centre8Group 1 - SubHeader 3Group 1 - Header 3Data - Line item153
Less: Projects (Manual)Group 1 - SubHeader 3.1Group 1 - Header 3Data - Line item (Manual)-16 
Cost_Centre9Group 1 - SubHeader 4Group 1 - Header 4Data - Line item184
Cost_Centre10Group 1 - SubHeader 4Group 1 - Header 4Data - Line item184
Cost_Centre11Group 1 - SubHeader 4Group 1 - Header 4Data - Line item184
Cost_Centre12Group 1 - SubHeader 4.1Group 1 - Header 4Data - Line item194
Cost_Centre13Group 1 - SubHeader 4.1Group 1 - Header 4Data - Line item194
Cost_Centre14Group 1 - SubHeader 4.1Group 1 - Header 4Data - Line item194
Cost_Centre15Group 1 - SubHeader 5Group 1 - Header 5Data - Line item1115
Cost_Centre16Group 1 - SubHeader 5Group 1 - Header 5Data - Line item1125
Cost_Centre17Group 1 - SubHeader 5.1Group 1 - Header 5Data - Line item1125
Cost_Centre18Group 1 - SubHeader 5.1Group 1 - Header 5Data - Line item1125
Cost_Centre19Group 1 - SubHeader 5.1Group 1 - Header 5Data - Line item1125
Cost_Centre20Group 1 - SubHeader 5.1Group 1 - Header 5Data - Line item1125
Cost_Centre21Group 1 - SubHeader 5.2Group 1 - Header 5Data - Line item1135
Cost_Centre22Group 1 - SubHeader 5.2Group 1 - Header 5Data - Line item1135
Cost_Centre23Group 1 - SubHeader 5.2Group 1 - Header 5Data - Line item1135
Cost_Centre24Group 1 - SubHeader 5.2Group 1 - Header 5Data - Line item1135
Cost_Centre25Group 1 - SubHeader 5.2Group 1 - Header 5Data - Line item1135
Cost_Centre26Group 1 - SubHeader NFRMGroup 1 - Non-Financial Risk ManagementData - Line item1156
Cost_Centre27Group 1 - SubHeader 7Group 1 - Header 7Data - Line item1177
Cost_Centre28Group 1 - SubHeader 7Group 1 - Header 7Data - Line item1177
Cost_Centre29Group 1 - SubHeader 7Group 1 - Header 7Data - Line item1177
Cost_Centre30Group 2 - SubHeader 1Group 2 - Header 1Data - Line item1209
Cost_Centre31Group 2 - SubHeader 1Group 2 - Header 1Data - Line item1209
Cost_Centre32Group 2 - SubHeader 1Group 2 - Header 1Data - Line item1209
US Amortization (Manual)Group 2 - SubHeader 2Group 2 - Header 2Data - Line item (Manual)-12210
Projects (Manual)Group 2 - SubHeader 2.1Group 2 - Header 2Data - Line item (Manual)-12310
Cost_Centre33Group 2 - subheader 3Group 2 - Header 3Calculation (SUM)-12511
IFRS 9 Amortization (Manual)Group 2 - subheader 3.1Group 2 - Header 3Data - Line item (Manual)-12611
Cost_Centre34Group 2 - subheader 3.2Group 2 - Header 3Data - Line item12711

 

 

3) 06. Hyperion Data (GL) - don't think you need this but here is a fictious sample

CC FullExpense LineFiscal YearScenarioMonthAmount
Cost_Centre1Total Operating Expenses2024ActualNov        10,000.00
Cost_Centre1Total Operating Expenses2024ActualDec        10,000.00
Cost_Centre1Total Operating Expenses2024ActualJan        10,000.00
Cost_Centre1Total Operating Expenses2024ActualFeb        10,000.00
Cost_Centre1Total Operating Expenses2024ActualMar        10,000.00
Cost_Centre1Total Operating Expenses2024ActualApr        10,000.00
Cost_Centre1Total Operating Expenses2024ActualMay        10,000.00
Cost_Centre1Total Operating Expenses2024ActualJun        10,000.00
Cost_Centre1Total Operating Expenses2024ActualJul        10,000.00
Cost_Centre1Total Operating Expenses2024ActualAug        10,000.00
Cost_Centre1Total Operating Expenses2024ActualSep        10,000.00
Cost_Centre1Total Operating Expenses2024ActualOct        10,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastNov           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastDec           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastJan           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastFeb           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastMar           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastApr           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastMay           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastJun           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastJul           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastAug           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastSep           2,000.00
Cost_Centre1Total Operating Expenses2025QTR2_ForecastOct           2,000.00
Cost_Centre1Total Operating Expenses2025ActualNov           3,000.00
Cost_Centre1Total Operating Expenses2025ActualDec           3,000.00
Cost_Centre1Total Operating Expenses2025ActualJan           3,000.00
Cost_Centre1Total Operating Expenses2025ActualFeb           3,000.00
Cost_Centre1Total Operating Expenses2025ActualMar           3,000.00
Cost_Centre1Total Operating Expenses2025ActualApr           3,000.00
Cost_Centre1Total Operating Expenses2025PlanNov           2,000.00
Cost_Centre1Total Operating Expenses2025PlanDec           2,000.00
Cost_Centre1Total Operating Expenses2025PlanJan           2,000.00
Cost_Centre1Total Operating Expenses2025PlanFeb           2,000.00
Cost_Centre1Total Operating Expenses2025PlanMar           2,000.00
Cost_Centre1Total Operating Expenses2025PlanApr           2,000.00
Cost_Centre1Total Operating Expenses2025PlanMay           2,000.00
Cost_Centre1Total Operating Expenses2025PlanJun           2,000.00
Cost_Centre1Total Operating Expenses2025PlanJul           2,000.00
Cost_Centre1Total Operating Expenses2025PlanAug           2,000.00
Cost_Centre1Total Operating Expenses2025PlanSep           2,000.00
Cost_Centre1Total Operating Expenses2025PlanOct           2,000.00

Hi @TR_TD 

If possible, please share the PBIX file so that we can better understand how the model contains relationships. We will work on it and be able to provide better assistance to resolve the issue.

Thank You.

Hi @TR_TD 

It's been a while since we last heard from you. We are ready to assist you with resolving the issue, but we need the necessary details from you. Kindly share the information required so we can better understand and address your issue.

 

Thank You!

Hi, I was able to get some help from a colleague and the following solution worked to remove filtering from the CC Mapping table which was causing the issue when I used the RM Expense Layout column:

 

VAR _NFRM =
    CALCULATE(
        [Amounts],
        '05. RM Expense Layout'[RM Expense Layout] = "Non-Financial Risk.",
        REMOVEFILTERS( '03. CC Mapping' )
    )
 
VAR _Result =
SWITCH(
    SELECTEDVALUE('05. RM Expense Layout'[RM Expense Layout]),
    "FCRM projects.", _FCRM,
                [Amounts]
                )
RETURN
    _Result
Alex_Sawdo
Resolver II
Resolver II

A first recommendation could be to re-write the DAX measures to use the FILTER kewyord instead: 
Measure 1: 

CALCULATE(
    SUM(
        '06. Hyperion Data (GL)'[Amount]
    ),
    FILTER(
        VALUES(
            '03. CC Mapping'[Group Level 2 (CALC)]
        )
        '03. CC Mapping'[Group Level 2 (CALC)]="Non-Financial Risk."
    )
)

And the second would be this:

CALCULATE(
    SUM('06. Hyperion Data (GL)'[Amount]),
    FILTER(
        VALUES(
            '05. RM Expense Layout'[RM Expense Layout]
        ),
        '05. RM Expense Layout'[RM Expense Layout] ="Non-Financial Risk."
    )
)

What I'm guessing is happening here is the filter context isn't properly being defined for the DAX measures, so the actual measure can't determine what needs to be filtered. 

My apoligies, I also didn't note the relationships in the diagram. Try changing the relationship between 05. RM Expense Layout and 03. CC Mapping to a Bi-Directional relationship. As it stands now in your model, any filter applied to 03. CC Mapping (whether it be through DAX or visual filters) has no bearing on 05. RM Expense Layout.

Thanks for the suggestion. Unfortunately it's still not working,  the measure calculation is still only showing in the NFRM row of the RM Expense Layout with either formula/measure.

TR_TD
Regular Visitor

Here is my screenshot #2 - couldn't include it in the original post

TR_TD_0-1748370748595.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.