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
jdevalk77
Frequent Visitor

Multiply per service

Hi, as a beginner in DAX I need some help for something which looks quite simple (and probably it is), but I don't know the solution.

I do have a table with standard time in minutes per service and another table with the quantity per service.
Now I want to calculate the total time in hours per service (190, 91, 232) as well as a total time (513 minutes).
Anyone?

jdevalk77_0-1675250552428.png

 

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

Hi @jdevalk77 ,

Please try below steps:

1. create measure with below dax formula

Measure =
VAR cur_service =
    SELECTEDVALUE ( Table1[Service] )
VAR cur_mt =
    CALCULATE ( MAX ( Table1[Minutes] ), Table1[Service] = cur_service )
VAR tmp =
    FILTER ( ALL ( Table2 ), Table2[Service] = cur_service )
VAR _val =
    SUMX ( tmp, [Quantity] )
RETURN
    cur_mt * _val
Measure 2 = SUMX(VALUES(Table1[Service]),[Measure])

2. add a table visual with field and measure

vbinbinyumsft_0-1675320227925.png

Please refer the attached .pbix file.

 

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 @jdevalk77 ,

Please try below steps:

1. create measure with below dax formula

Measure =
VAR cur_service =
    SELECTEDVALUE ( Table1[Service] )
VAR cur_mt =
    CALCULATE ( MAX ( Table1[Minutes] ), Table1[Service] = cur_service )
VAR tmp =
    FILTER ( ALL ( Table2 ), Table2[Service] = cur_service )
VAR _val =
    SUMX ( tmp, [Quantity] )
RETURN
    cur_mt * _val
Measure 2 = SUMX(VALUES(Table1[Service]),[Measure])

2. add a table visual with field and measure

vbinbinyumsft_0-1675320227925.png

Please refer the attached .pbix file.

 

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
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.