Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jhauw74
Frequent Visitor

Tagging Start and End dates for Sales Campaign

Hi Fellow experts - I am trying to create a DAX that will indicate with 1 or 0 - when the sales campaign starts & end.

 

I have tried this DAX : 

Active_Campaign =
Var Start_C = LOOKUPVALUE(Active_Campaign[Campaign Start Period],Active_Campaign[Campaign Start Period],[Calendar_Date])
Var End_C = LOOKUPVALUE(Active_Campaign[Campaign End Period],Active_Campaign[Campaign End Period],[Calendar_Date])
Return
IF(AND(
    Start_C >= TODAY(),
    End_C) <= TODAY(),
    "1","0")
However it errors out : 
DAX comparison operations do not support comparing values of type True/False with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values.

Lookup value is for getting a date value from another table for both Start & End of the Sales Campaign.
Any ideas on  how to make this working? TIA.


1 ACCEPTED SOLUTION

7 REPLIES 7
jhauw74
Frequent Visitor

Thanks - I have the 2 tables below - hope it will be clear:

Table 1 - Date look up - indicating when the campaign start and ends

Campaign Start PeriodCampaign End Period
12-Oct-2312-Dec-23


Table 2: this is where the DAX calculation will be added as a new column in my dim Calendar Table - where tagging dates during campaign period as 1, outside that period will be tagged as 0.

Desired Results:

Daily Campaign DatesTags
24-Sep-230
25-Sep-230
26-Sep-230
27-Sep-230
28-Sep-230
29-Sep-230
30-Sep-230
1-Oct-230
2-Oct-230
3-Oct-230
4-Oct-230
5-Oct-230
6-Oct-230
7-Oct-230
8-Oct-230
9-Oct-230
10-Oct-230
11-Oct-230
12-Oct-231
13-Oct-231
14-Oct-231
15-Oct-231
16-Oct-231
17-Oct-231
18-Oct-231
19-Oct-231
20-Oct-231
21-Oct-231
22-Oct-231
23-Oct-231
24-Oct-231
25-Oct-231
26-Oct-231
27-Oct-231
28-Oct-231
29-Oct-231
30-Oct-231
31-Oct-231
1-Nov-231
2-Nov-231
3-Nov-231
4-Nov-231
5-Nov-231
6-Nov-231
7-Nov-231
8-Nov-231
9-Nov-231
10-Nov-231
11-Nov-231
12-Nov-231
13-Nov-231
14-Nov-231
15-Nov-231
16-Nov-231
17-Nov-231
18-Nov-231
19-Nov-231
20-Nov-231
21-Nov-231
22-Nov-231
23-Nov-231
24-Nov-231
25-Nov-231
26-Nov-231
27-Nov-231
28-Nov-231
29-Nov-231
30-Nov-231
1-Dec-231
2-Dec-231
3-Dec-231
4-Dec-231
5-Dec-231
6-Dec-231
7-Dec-231
8-Dec-231
9-Dec-231
10-Dec-231
11-Dec-231
12-Dec-231
13-Dec-230
14-Dec-230
15-Dec-230
16-Dec-230

 

pls try

Screenshot_1.png

Thank you it works very well 🙂

Ahmedx
Super User
Super User

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Ritaf1983
Super User
Super User

Hi @jhauw74 

It seems that one of the values in your dates is not of the date data type. If all values were dates, the formula would be functioning correctly.

Ritaf1983_0-1700797485394.png

for more detailed suggestions please share the tables to work with

If this post helps, then please consider Accepting it as the solution to help the other

members find it more quickly

 

Ahmedx
Super User
Super User

I think you have a column
Active_Campaign[Campaign Start Period] as text
post the file we can help you

Is identify as date value : 

jhauw74_0-1700797302726.png

Same goes for Campaign End Period too

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.