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

dax measure to multiply a column from a different table by a distinct count and filter of current t

I have a table of all of my customer transactions and a separate table with my sales quotas. I'm trying to get the formula to:

Distinct count the number of transaction dates in the customer transactions table, where the working day=yes. Then multiply that number of days by the daily quota.

 

I currently have this formula but it is giving me an error

 

Quota =
CALCULATE(
DISTINCTCOUNT('Customer Sales Transactions'[Transaction Date]),
FILTER('Customer Sales Transactions',
'Customer Sales Transactions'[CS Working Day]="Yes")
)
*'Sales Team Quotas'[Daily Quota])

1 ACCEPTED SOLUTION
Floriankx
Solution Sage
Solution Sage

Do you want to create a measure or a calculated column?

At first it seems your last ')' is too much. Maybe this helps.

 

Here an alternative if not.

For Measure you could try:

Quota =
CALCULATE(
COUNTROWS(VALUES('Customer Sales Transactions)),
FILTER('Customer Sales Transactions',
'Customer Sales Transactions'[CS Working Day]="Yes")
)
*Sum('Sales Team Quotas'[Daily Quota])

 

In this case you need to ensure a relation between these tables.

View solution in original post

5 REPLIES 5
Floriankx
Solution Sage
Solution Sage

Do you want to create a measure or a calculated column?

At first it seems your last ')' is too much. Maybe this helps.

 

Here an alternative if not.

For Measure you could try:

Quota =
CALCULATE(
COUNTROWS(VALUES('Customer Sales Transactions)),
FILTER('Customer Sales Transactions',
'Customer Sales Transactions'[CS Working Day]="Yes")
)
*Sum('Sales Team Quotas'[Daily Quota])

 

In this case you need to ensure a relation between these tables.

Your alternative option worked, thank you so much!

 

Can you help me understand how this worked and why the 'Sum' function was used at the end?

 

 

Hello, 

 

you can't reference to a row in a measure so you have to wrap it with SUM, MIN, MAX etc even if there is only one row each relevant value.

 

Best regards.

This solution worked great, however, i have the chart connected to a slicer where i select the month i want to see, but the formula isnt calculating correctly based on the slicer. How do i get it to narrow by the time frame in the slicer?

Do you have a separate DateTable?

 

If not there is your problem. You have to create a DateTable with contigous dates relate the other two tables and slice by the DateTable.

 

If you have several years slicing by month gives you the month value of all available years.

 

Best regards.

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.