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
Anonymous
Not applicable

How can I make this calculated column dynamic with multiple slicers?

 

 

Hi

 

I use this calculated column to calculate days between entries. I want to calculate days between when there are multiple slicers.  It works with the ID slicers but not anything else. Any ideas?

 

With ID slicer works fineWith ID slicer works fine

Does not work with my category slicerDoes not work with my category slicer
 
Days Between =
VAR temp =
    TOPN (
        1,
FILTER (
            'Time Stamp',
            'Time Stamp'[ID] = EARLIER ( 'Time Stamp'[ID] )
                && 'Time Stamp'[Occurrence] < EARLIER ( 'Time Stamp'[Occurrence] )
        ),
        [Occurrence], DESC
    )
RETURN
    DATEDIFF ( MINX ( temp, [Occurrence] ), 'Time Stamp'[Occurrence], DAY )
 
Thanks
4 REPLIES 4
Anonymous
Not applicable

Calculated columns are only updated when you refresh the dataset. You would need (and probably should anyway) covert this to a measure. 

Anonymous
Not applicable

snip3.PNG

 

 

The reason I used a calculated column is because I would always get an error with the measure using the exact same DAX.



 

Anonymous
Not applicable

The concept of earlier doesnt exists if you take your calculated column logic and directly apply to a measure. You can use earlier in a measure with some additiona logic, but probably easier to just add an index to your table so you have a concept of what is previous. You can do that using a calculated column, or better yet power query. can you upload some sample data?

Anonymous
Not applicable

This is what my data looks like.

 

Sliced by ID without category slicerSliced by ID without category slicerSliced by ID with category slicer. Does not count days properly.Sliced by ID with category slicer. Does not count days properly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.