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

Annotate range of dates on a visual without using switch cases / multiple if statements

Hi,

 

I'm looking to annotate a set of specific points on a visual. I actually have a diverse dataset, with up to 8 slicers influencing the data at one time including date, but I would settle for an easy way to just condition on a range of dates without having to create multiple entries in a switch case as I often have one comment to propagate over multiple dates.

 

Currently I have a custom column that looks similar to this:

 

Comments = 
SWITCH ( date_column, 
DATE(27/01/2020), "Same comment", 
DATE(26/01/2020), "Same comment",
DATE(25/01/2020), "Same comment")

 

 

I tried using DATESBETWEEN() in DAX, and also manually typing DATE(27/01/2020) && DATE(26/01/2020) to annotate the same comment across multiple dates, but neither worked with the switch command. Is there an easier way of doing this?

 

A good outcome for me would be to reduce the toil in copy and pasting say 10 dates. An ideal outcome for me would be an easy way to also involve other slicer values to only have the comments displayed on that particular combination of data.

 

Thanks!

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous ,

If you want to create a column by condition, I think you could try to use below expression :

Column = SWITCH(TRUE(),'Table'[date]>date(2020,1,20) && 'Table'[date]<date(2020,2,2), "same","others")

 565.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
dax
Community Support
Community Support

Hi @Anonymous ,

If you want to create a column by condition, I think you could try to use below expression :

Column = SWITCH(TRUE(),'Table'[date]>date(2020,1,20) && 'Table'[date]<date(2020,2,2), "same","others")

 565.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors