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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Joseph_Hchaime
Helper III
Helper III

Having trouble with DAX formula

Hi,

 

I need to translate a formula into a dax measure. 

 

The formula is: # new clients opened and billed this period/ total # of clients billed in the same period (not only new)

 

My data has a clients table with unique IDs per client, a created date for the client as well as a bills table with unique IDs per bill and the bill issue date. 

 

I tried using CALCULATE (COUNT(Clients_ID)),Client_Creation_Date = Year (Today)),Bill_Issue_Date = Year (Today)) - For the New Clients portion of the formula (Numerator). 

 

but it isn't working. 

 

Can someone help? it's time sensitive. 

1 ACCEPTED SOLUTION

It could be because you are comparing a full Date with a Year.

 

Try adding YEAR() to all the dates.

Year(Client_Creation_Date) = Year (Today())

Year(Bill_Issue_Date) = Year (Today())

View solution in original post

8 REPLIES 8
Joseph_Hchaime
Helper III
Helper III

Yes exactly. No issue with the relationship. It's the dax syntax that i'm having trouble with. 

Joseph_Hchaime
Helper III
Helper III

Yes exactly. No issue with the relationship. It's the dax syntax that i'm having trouble with. 

Ale
Resolver II
Resolver II

How is the relationship between these 2 tables (Client and Bills)? Do you have Client ID in your Bills table to join them?

Can you then double check your DAX? The way you pasted here you are closing the CALCULATE bracket right after the COUNT, so the formula will not work as it ignores everything that comes after it.

 

CALCULATE (COUNT(Clients_ID)),Client_Creation_Date = Year (Today)),Bill_Issue_Date = Year (Today))

 

Try to remove that bracket (in red) and see if the formula works.

Screenshot 2022-08-17 095905.png

 

I got this error

You must use Today() and not only Today.

Year(Today())

I noticed that and I corrected it after posting my reply. The thing is I'm getting blank as a result. Whereby I'm positive we've billed new clients this year 

It could be because you are comparing a full Date with a Year.

 

Try adding YEAR() to all the dates.

Year(Client_Creation_Date) = Year (Today())

Year(Bill_Issue_Date) = Year (Today())

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.