Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I'm sure this is easy and I've tried more than a few solutions I've found on the boards already, but I can't seem to get it to work properly.
I'm tryign to create a conditional calculated column between two tables.
Table 1
Event - Begin Date - End Date
Table 2
Calendar Date
What I need is a measure in my calendar that identifies the day as an "Event day" or " Non Event".
I can't connect the two tables since this would introduce ambiguity, so ultimatly I need somthign like
Event_Day = IF( Table2[Cal_Dt] >= Table1[Bg_Dt] && Table2<= Table1[End_Dt], "Event", "No Event")
I think you want something like this as a calculated column on Table 2:
Event_Day =
VAR CurrDate = Table2[Cal_Dt]
VAR EventCount =
COUNTROWS (
FILTER ( Table1, CurrDate >= Table1[Bg_Dt] && CurrDate <= Table1[End_Dt] )
)
RETURN
IF ( EventCount > 0, "Event ", "No Event" )
This gets me much closer, but instead of returning "Event" for the Days between [Bg_dt] and [End_Dt] it is returning "Event" between the Max and Min of Table1. Table1 has several rows of Events with various begining and end dates in an unrelated table. When I choose an event in a slicer I need to evaluate the calendar table with those begining and ending dates. However, the context of the slicer is not carrying over to the calcualted column.
It is not possible for a slicer to affect a calculated column, so you'd need to use a measure instead.
However, it's not clear to me how exactly you'd be using such a measure, so I'd need more context to understand know how to write it.
Since adding dynamic vertial lines is, for whatever reason, incrediablly difficult; I was hoping I could create a column that dynamically calculated against my calendar if a particual day was an event day or not. In this way I could use that column as a legend and highlihgt that portion of my line visual as an event. So, maybe there is another way to go about this?
Hi @Anonymous
The data in a calculated column is populated and refreshed when it is created or when the dataset is refreshed. It cannot be dynamically changed accroding to users' interactions in the report. That means it cannot be influenced by the slicers and filters in the report. So you should use a measure to realize that.
You say you want to use that column as a legend, do you want something like a line chart with two lines (one for "Event" and the other for "No Event")? Not clear about the expected result you want. Maybe you can refer to below articles:
Dynamic Legend in #Power BI Visual, Line Chart - Prathy's Blog
DAX Measure in the Axis of the Power BI Report - RADACAD
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
Hi @Anonymous ,
If you want to work with dates in your if statement then you need to use, date(2021,06,01) like this.
Hope it solves your problem.
Thanks
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.