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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
johnce1234
New Member

Switch Into another Measure

Good Evening, 

 

I am having a little issue with a measure that goes into my switch

 

I have a schema as follows

 

G/L Entries (Base data)  (Mapped to Account Category code 1 to many)

G/L Account Categories (Mapped to report schema via the codes below 1 to many)

Report Schema

 

 

Report Schema 

ReportLineID

IS0100

IS0200

IS0500

IS0800

 

BS1

BS2

BS3

 

Basically want a switch statement to tell me when I have BS3 selected sum all the G/L entry table amounts that are mapped to IS1 IS2 and IS3

 

Below Measures

 

BS Switch = SWITCH(TRUE() ,
SELECTEDVALUE('Report Structure'[ReportLine ID]) = "BS3" , [BS PL Amount],
[BS Amount]
)
 
BS PL Amount = VAR SelectedDate = Max('Calendar Table'[Date])
RETURN
SUMX(
    Filter(
        ALL('Calendar Table'),
        'Calendar Table'[Date] <= SelectedDate
    ),
    Calculate(Sum(g_L_Entrys[amount]),
    FILTER(
            'g_L_Account_Categorys',
            'g_L_Account_Categorys'[reportid] IN {"IS0500" , "IS0100" , "IS0200", "IS0800" }
    )
))
 
It will not bring any figures against this, I tested the switch function with just a value and this works. 
 
TIA
1 REPLY 1
Anonymous
Not applicable

First, I'll address the SWITCH statement in your "BS Switch" measure:

BS Switch = SWITCH(TRUE(),
    SELECTEDVALUE('Report Structure'[ReportLine ID]) = "BS3", [BS PL Amount],
    [BS Amount]
)

The SWITCH function here checks if the selected ReportLine ID is "BS3" and returns [BS PL Amount] if true, otherwise [BS Amount]. This part of the code looks correct at first glance.

Now, let's focus on your "BS PL Amount" measure:

BS PL Amount = 
VAR SelectedDate = MAX('Calendar Table'[Date])
RETURN
SUMX(
    FILTER(
        ALL('Calendar Table'),
        'Calendar Table'[Date] <= SelectedDate
    ),
    CALCULATE(
        SUM(g_L_Entrys[amount]),
        FILTER(
            'g_L_Account_Categorys',
            'g_L_Account_Categorys'[reportid] IN {"IS0500", "IS0100", "IS0200", "IS0800" }
        )
    )
)

This measure seems to be designed to calculate the sum of G/L Entry amounts based on specific conditions related to dates and report IDs.

Here are a few things to check:

1. Make sure that 'Report Structure'[ReportLine ID] is correctly associated with the "BS3" value in your dataset.
2. Ensure that your 'Calendar Table' and 'g_L_Account_Categorys' tables are appropriately linked with the relevant columns (e.g., Date and reportid).
3. Double-check your data to see if there are entries in the 'g_L_Entrys' table that match the conditions specified in your FILTER clauses.
If all these aspects are correct, the problem might be related to the data or how the tables are structured. Check if your data is correctly loaded, and there are no filters or slicers affecting the results when viewing your visualizations.

Additionally, consider using the DAX function SUMMARIZE to understand the data within your tables and ensure that the relationships are set up correctly.

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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