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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

What's wrong with this Dax?

Any1 know what's wrong with this DAX?  if the BequestDate contain 2016, i want the new handraisers=2016, if the BequestDate contain 2017, i want the new handraisers = 2017, if the BequestDate contain 2018, i want the new handraisers = 2018.  otherwise = blank. 

 

thanks

CRM.PNG

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

What's the column type of BequestDate? If it is Text, you would get this kind of result. You can change the column Type to Number, and use the kind of following DAX

 

New Handraisers = IF((ContactSet[BequestDates]<=2016),2016,IF((ContactSet[BequestDates]=2017),2017,IF((ContactSet[BequestDates]>=2018),2018)))

BTW: you need to adjust the DAX based on the vaule of BequestDate

View solution in original post

RahulYadav
Resolver II
Resolver II

Hi @Anonymous,

You can use below formula to solve your problem.

 

New Handraisers = 
if(SEARCH("2016",ContactSet[BequestDates],,-1)>0,"2016",
    if(SEARCH("2017",ContactSet[BequestDates],,-1)>0,"2017",
        if(SEARCH("2018",ContactSet[BequestDates],,-1)>0,"2018","")))

The "CONTAINS" functions returns true if values for all referred columns exist, or are contained, in those columns; otherwise, the function returns false.

 

Thanks,

Rahul

View solution in original post

2 REPLIES 2
RahulYadav
Resolver II
Resolver II

Hi @Anonymous,

You can use below formula to solve your problem.

 

New Handraisers = 
if(SEARCH("2016",ContactSet[BequestDates],,-1)>0,"2016",
    if(SEARCH("2017",ContactSet[BequestDates],,-1)>0,"2017",
        if(SEARCH("2018",ContactSet[BequestDates],,-1)>0,"2018","")))

The "CONTAINS" functions returns true if values for all referred columns exist, or are contained, in those columns; otherwise, the function returns false.

 

Thanks,

Rahul

Anonymous
Not applicable

What's the column type of BequestDate? If it is Text, you would get this kind of result. You can change the column Type to Number, and use the kind of following DAX

 

New Handraisers = IF((ContactSet[BequestDates]<=2016),2016,IF((ContactSet[BequestDates]=2017),2017,IF((ContactSet[BequestDates]>=2018),2018)))

BTW: you need to adjust the DAX based on the vaule of BequestDate

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.