Forum Discussion

eliasayyy's avatar
eliasayyy
Memorable Member
8 months ago
Solved

Dax Calculation to go Backwards

Hello everyone i have a complex Ask.
I have a visual which has 5 slicer each from seperate dim tables
slicer 1: clinic site from dimSite table
slicer 2: clinic contract from dimContract table
slicer 3 : croom modality from dimModality table
slicer 4: patient Category from dimCategory table
slicer 5: date range from dimDate table

all those tables connected to my 4 facttables in one to many relationships

I have my backlog table which i calculate the Total sum of backlog ignoring date filter so my formula for backlog is


Total Backlog (Unbooked) = 
CALCULATE(
    DISTINCTCOUNT(
        BacklogTable[Patients]
    ),
    ALL(dimDate[Date])
)

 

so when i apply any of the 4 filters exceot date, my numebr will show accordingly

next step i want to visualize this number by week in line chart

however i need to start on my max date available for the number to be the backlog

so today we are week 52(22/12/2025)

on week 22 it should show on chart the total backlog formula

 



just like that both are 2405

now to fill the chart, i need to go backwards with my forumula

my forumula for week 51 Backlog = Week 52 Backlog + (Total referrals - total scans) of week 51

so to visually explain, the above picture shows week 52 backlog 2405

so now we need to see difference of referalls and scans on week 51, and add it it to backlog to get week 51


so week 52 we had 2405, week 51 we had -799 = referalls - scans hence backlog of week 51 should be 2405 + (-799) = 1606

the way im acheiving this is by creating 2 calculated tables

Weekly Flow Table = 
SUMMARIZE (
    dimDate,
    dimDate[YearWeek],
    "WeekEndDate", MAX ( dimDate[Date] ),
    "NetWeeklyChange",
        CALCULATE ( [Total Referrals] - [Total Scans] )
)



Weekly Backlog Table = 
VAR AnchorWeek =
    MAXX ( 'Weekly Flow Table', [YearWeek] )

VAR AnchorBacklog =
    [Total Backlog (Unbooked)]

RETURN
ADDCOLUMNS (
    'Weekly Flow Table',
    "Backlog",
    VAR ThisWeek = [YearWeek]
    VAR Adjustment =
        SUMX (
            FILTER (
                'Weekly Flow Table',
                [YearWeek] >= ThisWeek
                    && [YearWeek] < AnchorWeek
            ),
            [NetWeeklyChange]
        )
    RETURN
        IF (
            ThisWeek = AnchorWeek,
            AnchorBacklog,
            AnchorBacklog + Adjustment
        )
)


and i get in my weekly backlog table this




so this calculated table is doing the work

however as soon as i try to apply any filter from the slicer, backlog doesnt filter

Example



i applied filter to my contract, the card gets filtered to 395 however the table remains 2405

is there a better way to do this?

or how to make all my filters apply

thank you in advance

  • Hi eliasayyy 

     

    Calculated tables and columns are not aware of slicer selections. They calculated once upon refresh, when modified, or the referenced measures/columns/tables have been changed. That aside, it would be easier for us to work on a solution if you provided a sample pbix, of course, with confidential data removed.

5 Replies

  • Hi eliasayyy 

     

    Calculated tables and columns are not aware of slicer selections. They calculated once upon refresh, when modified, or the referenced measures/columns/tables have been changed. That aside, it would be easier for us to work on a solution if you provided a sample pbix, of course, with confidential data removed.

    • eliasayyy's avatar
      eliasayyy
      Memorable Member

      hello! i will provide sample in a bit thank you!

  • Calculated tables are static — not filter-aware — so your existing approach won’t respond to slicers.

    • eliasayyy's avatar
      eliasayyy
      Memorable Member

      hello! i am aware of the limitations i just did this approach to help understand what i need. how do i solve this?

  • Thankyou, danextian and cengizhanarslan for your responses.

    Hi eliasayyy,

    We appreciate your question on the Microsoft Fabric Community Forum and thank you for the update.

    Kindly provide sample data that clearly demonstrates your query in a structured format (not as an image) to help us understand and resolve the issue. Also include a screenshot of your Model view showing the tables and relationships involved, along with a small sample of 2 to 3 rows from each relevant table. Please ensure that the data is relevant, free from any sensitive information, and directly related to the issue. Additionally, share the expected outcome based on the provided example.

    If you have any further queries, please feel free to contact the Microsoft Fabric community.

    Thank you.