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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Madalin_Manaila
Regular Visitor

Calculate DOH based on weeks

Hi all, 

 

I have 2 tables: 

Inventory.jpg

and 

Usage.jpg

How can I calculate DOH for a following result:

DOH item 111= 6 days (for usage Week N) + 161 days (23 weeks * 7 days) + 5 days (for usage Week N+24 for an average usage 1000 per day) = 172 days

DOH item 222 = 4 days (for usage Week N - with an average 75 usage/day)

DOH item 333 = 6 days (for usage Week N) + 7 days (for usage Week N+1) + 5 days (for usage Week N+2 - for an average usage 7000 per day)= 18 days

Thank you.

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @Madalin_Manaila ,

Please try to create measure with below dax formula:

DOH Calculation = 
SUMX(
    'YourTable',
    IF(
        'YourTable'[ItemID] = 111,
        6 + (23 * 7) + 5,
        IF(
            'YourTable'[ItemID] = 222,
            4,
            IF(
                'YourTable'[ItemID] = 333,
                6 + 7 + 5,
                0
            )
        )
    )
)

This example is quite basic and assumes a static calculation. You'll need to replace the static numbers with the actual logic that calculates the days based on your weekly and daily usage data.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-binbinyu-msft
Community Support
Community Support

Hi @Madalin_Manaila ,

Please try to create measure with below dax formula:

DOH Calculation = 
SUMX(
    'YourTable',
    IF(
        'YourTable'[ItemID] = 111,
        6 + (23 * 7) + 5,
        IF(
            'YourTable'[ItemID] = 222,
            4,
            IF(
                'YourTable'[ItemID] = 333,
                6 + 7 + 5,
                0
            )
        )
    )
)

This example is quite basic and assumes a static calculation. You'll need to replace the static numbers with the actual logic that calculates the days based on your weekly and daily usage data.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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