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
united2win
Helper III
Helper III

DAX Formula Help

Hi,

I have the following table of customer's and revenue dates. I would like to create DAX calculated column that tags the customer as 'New' when there is no revenue reported in the previous month. It's an easy formula in excel, but how do I replicate it in DAX? Thank you

 

RevenueDateCustomerDAX Formula
01/01/2022Client ANew
01/02/2022Client A 
01/03/2022Client A 
01/05/2022Client ANew
2 ACCEPTED SOLUTIONS
vanessafvg
Super User
Super User

sorry for the delay in responding.

 

you could try something like this

 

New Customer =
var maxdate = PREVIOUSMONTH(NewCustomer[RevenueDate])
return if(maxdate, BLANK(),"New")




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

Thomas_Daubert
Frequent Visitor

hello,

I did it with this formula : 

 
new =
var mois_prec = DATEADD(Sheet1[Revenue Date], -1, MONTH)
return
    if(
        CALCULATE(
             COUNT(Sheet1[Customer])
             , mois_prec
        ) = 0
        , "New"
    )

View solution in original post

8 REPLIES 8
Thomas_Daubert
Frequent Visitor

hello,

I did it with this formula : 

 
new =
var mois_prec = DATEADD(Sheet1[Revenue Date], -1, MONTH)
return
    if(
        CALCULATE(
             COUNT(Sheet1[Customer])
             , mois_prec
        ) = 0
        , "New"
    )

Thanks Thomas, but still didn't work.

 

Sorry to ear that 😞 it was working on my Pbix file.

 

PS : Do you know how to add pbix files ? i can't find any option to do that.

No worries, I have found the solution. 

vanessafvg
Super User
Super User

sorry for the delay in responding.

 

you could try something like this

 

New Customer =
var maxdate = PREVIOUSMONTH(NewCustomer[RevenueDate])
return if(maxdate, BLANK(),"New")




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Thanks Vanessa,

 

The solution didn't seem to work, but I see where you're coming from with using the Previous Month logic. I have now created a PreviousMonth column in my data set, I just can't find a DAX formula that will result in the below (where previousDate is not found in RevenueDate for Client A)

Thank you

 

RevenueDatePreviousDateClient DAX Formula
01/06/202201/05/2022Client ANew
01/07/202201/06/2022Client A 
01/08/202201/07/2022Client A 
01/10/202201/09/2022Client ANew
vanessafvg
Super User
Super User

is it only the previous month your are interested in or if they have never had a revenue date before? basically just taking their first date and assigning it to new?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Only previous month please. I have a formula already to calculate if the customer has already recognized revenue in the past. Thank you. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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