Forum Discussion
Hours Comparison Using USERELATIONSHIP: Unable to Display Trend
- 1 year ago
HI hello_12345 ,
The main issue is that USERELATIONSHIP can override your base week context, so your trend visuals end up showing the wrong weeks. The best way to solve this is to use TREATAS in your measure. This keeps your X-axis (weeks) correct and maps your base weeks to the comparison weeks for the calculation.
Here’s how you can write your comparison measure:
comparison_vol =
CALCULATE( [base_vol], REMOVEFILTERS(dim_Week_base[Year_wk]),
TREATAS( VALUES(dim_Week_base[Year_wk]),
dim_Week_comparison[Year_wk] ) )Keep your trend visuals aligned to the weeks you select, Show the correct comparison values for each week, And avoid the visual context issues that come up with USERELATIONSHIP.
- 1 year ago
Hi hello_12345 ,
Yes, TREATAS can be used, but ensure:
TREATAS maps correctly: TREATAS(VALUES(BaseTable[Column]), ComparisonTable[Column]) is right.
Relationships: Underlying relationships (active or inactive with USERELATIONSHIP) are consistent with what TREATAS expects.
Filter Context: REMOVEFILTERS might be too broad; consider ALLEXCEPT or ALLSELECTED if you need to preserve some context.
Your USERELATIONSHIP approach was often simpler for comparisons if the relationships are set up. TREATAS is powerful but can be tricky with complex filter contexts.
Key thing: The base_vol calculation itself needs to be correctly picking up the dim_Week_comparison and dim_b_comparison filters via TREATAS or USERELATIONSHIP. If base_vol is not reacting, it implies the filter context from the comparison tables isn't reaching it.
Hi hello_12345
I wanted to check if you had the opportunity to review the information provided by users. Please feel free to contact us if you have any further questions.
Hi hello_12345
Hope everything’s going smoothly on your end. I wanted to check if the issue got sorted. if you have any other issues please reach community.