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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Vinit
Frequent Visitor

DAX Divide Formula

Hi,

I want DAX formula for Divide,

it likes, 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 dates =  (VALUES ( 'Production of the day'[actualendtime] ), 

1 = totals selected no. of days minus 1 day (it is value not text),

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

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi

Just count the number of days without sundays, it is easier

 

Working Days = 
CALCULATE(
    COUNTROWS('Date Table'), 
    FILTER('Date Table', 
        Not WEEKDAY('Date Table'[Date],2) in {7}
    )
)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi,

 

Please give some samples of your data. Thks

Vinit_0-1665128811834.png

In the above image,

In Date, Both Date (01/09/2022) & (30/09/2022) are coming from same column

i.e. 'Production of the day'[actualendtime]

Below,     J961     SH1599     C18      BL5

              36.962    61.500     0.692    0.192

here for e.g. ,

J - Jeans(it is a product) , 961 - Total product count between 01/09/2022 & 30/09/2022, 

36.961 = 961/(30-4) i.e. 30- total selected days & 4 - no. of sundays between selected days(01/09/2022)&(30/09/2022).

 

here is contect , 

Production of the day'[productshortname] = J

COUNT('Production of the day'[productshortname]) = 961

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

no. of sundays i.e. 01/09/2022 & 30/09/2022 = 4

( how should i write DAX for no. of Sundays only between any selected date)

 

So I required DAX formula for 36.961 i.e 961/(30-4) 

hope you get it.

Anonymous
Not applicable

Hi

Just count the number of days without sundays, it is easier

 

Working Days = 
CALCULATE(
    COUNTROWS('Date Table'), 
    FILTER('Date Table', 
        Not WEEKDAY('Date Table'[Date],2) in {7}
    )
)

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors