Forum Discussion
Avoiding filtered context with Variable. Help needed
- 5 years ago
danielboi , In the above I see one change , if that can work for you
VAR DateMax =
CALCULATE(
MAXX(
filter(allselected(FactFIRE),
FactFIRE[Version ID]=2),
FactFIRE[Period ID]
)
)
RETURN
Hello amitchandak,
thanks. Highly appreciated your effort. My question is not so much going into the direction how to achieve to show certain numbers, but more fundamental. How to avoid, that my attempt to filter for the max date of actual version is not going to pass on a filter context only showing actual numbers.
Possible that my entire approach is not very efficient, but I want to go live with V1 next week and this seems to be the remaining hurdle to increase the user experience (or rather avoid user confusion)
By replacing the MaxDate at the very bottom with a hard coded date I get exactly what I want. So I assume that my way of extracting the date is wrong or I need to add something to the final calculate formula to eliminate the filter context generated with my variable
All Values Cons MaxDate =
VAR DateMax =
CALCULATE(
MAXX(
FactFIRE,
FactFIRE[Period ID]
),
FactFIRE[Version ID]=2
)
RETURN
CALCULATE(
[All Values Uncons],
FILTER(
FactFIRE,
not(
CONTAINS(
DimHierarchy,
DimHierarchy[CPOC],
FactFIRE[PCPOC]
)
)
),
FactFIRE[Period ID]<=DateMax
)+0
danielboi , In the above I see one change , if that can work for you
VAR DateMax =
CALCULATE(
MAXX(
filter(allselected(FactFIRE),
FactFIRE[Version ID]=2),
FactFIRE[Period ID]
)
)
RETURN
- danielboi5 years agoHelper I
Yesssssss!!!!!! You did it.
This did the trick.
Meanwhile I also found a solution to create a separate table with the needed date, but I like this much better 🙂