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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

DAX Divide function

I want to divide, Count(items.length) / workingDays. { Count(item.length) = count of different product, and Working days = No. of days betwwen two selected dates }
for that I wrote DAX function
Measure 4 = DIVIDE(CALCULATE(COUNT('Production of the day'[productshortname])),VALUES('Production of the day'[actualendtime]))
but it doesn't show any result. I even make separete measure for Count and Values of working days and divide these measure by making another masure. but it didn't work.
What is going wrong.? How should i make it correct.?
3 REPLIES 3
Vinit
Frequent Visitor

I want DAX formula for Divide,

it's like, Measure = No. of product / (no. of days between two dates - 1 - No. of Sundays in selected period)

 

Measure =

COUNT('Production of the day'[productshortname]/ (VALUES ( 'Production of the day'[actualendtime] )- 1 - no. of sundays)

 

how should i write Correct fromula for this.

Here is context of each term, 

No. of product = COUNT('Production of the day'[productshortname]),

no. of days between two selected dates =  (VALUES ( 'Production of the day'[actualendtime] ), 

1 = totals selected no. of days minus 1 day ( 10 -1=9; 10 - totals selected no. of days between dates ),

No. of Sundays in selected period = no. of sundays( how should i write DAX for no. of Sundays between selected date only)

daXtreme
Solution Sage
Solution Sage

@Anonymous 

 

Each DAX function has input arguments with their correct types and output with the correct type. When you pass something to a function, you have to obey the rules of syntax and types. It's like in mathematics: you can't expect that adding a set to a number will yield something meaningful - they are different objects and the "+" operation is not defined for them. VALUES, as already pointed out, is a TABLE FUNCTION, not a scalar, so you can't put it under DIVIDE which expects 2 scalars.

 

You probably fish for something like:

[Measure 4] =
DIVIDE(
    DISTINCTCOUNT( 'Production of the day'[productshortname] ),
    DISTINCTCOUNT( 'Production of the day'[actualendtime] )
)

If you're not sure about a function, go to http://dax.guide and look for it (there's a Search box on the left-hand side). Then pay attention to the input and output.

tamerj1
Super User
Super User

Hi @Anonymous 
VALUES is a table function. What are expecting the following argument to return

VALUES('Production of the day'[actualendtime])

What is the content of the 'Production of the day'[actualendtime] column?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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