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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Yajita24MM
New Member

How can I Calculate measure based on days and causes?

Hi everybody,

Please I need your help! I have a table that relates hours, months and causes. I am looking for a dax measure or code;

MonthDaysCauses
January1Cause 1
January1Cause 1
January12Cause 1
April15Cause 1
April15Cause 2
June 20Cause 2
June 4Cause 1
July5Cause 3
November10Cause 3
November15Cause 1

The measure i need is KPI = (( Sum of days per cause) / (Sum of total hours per month))*24

For example:  KPI (Cause 1: January) = (48/14)*24 = 82.28

Thank you so much.
Best Regards
 
Yaja
Perú

 

 

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

Hi @Yajita24MM ,

I created a sample that you could reference to have a try.

Measure =
VAR a =
    CALCULATE ( SUM ( 'Table'[Days] ), ALLEXCEPT ( 'Table', 'Table'[Causes] ) )
VAR b =
    CALCULATE ( SUM ( 'Table'[Days] ), ALLEXCEPT ( 'Table', 'Table'[Month] ) )
RETURN
    DIVIDE ( a, b ) * 24

2.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
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

3 REPLIES 3
v-xuding-msft
Community Support
Community Support

Hi @Yajita24MM ,

I created a sample that you could reference to have a try.

Measure =
VAR a =
    CALCULATE ( SUM ( 'Table'[Days] ), ALLEXCEPT ( 'Table', 'Table'[Causes] ) )
VAR b =
    CALCULATE ( SUM ( 'Table'[Days] ), ALLEXCEPT ( 'Table', 'Table'[Month] ) )
RETURN
    DIVIDE ( a, b ) * 24

2.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for your help, you save my life😊

amitchandak
Super User
Super User

Try Like

 

divide(
 CALCULATE (
        max ( 'Table'[Days] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Causes] )
        )
    ),CALCULATE (
        sum ( 'Table'[Days] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Month] )
        )
    ))
	

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Kudoed Authors