Forum Discussion
Switch Into another Measure
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.