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
JG00012
Regular Visitor

Getting Per minute cost based on total minutes per month then by minutes per user

Hello Experts,

 

Im currently struggeling on getting the correct DAX computation to get the cost per minute.

 

 

Below i created a Dax calculation to get the "per minute'  cost
Per minute = DIVIDE([Total], [Minutes]) which is correct

DateMinutesPer minuteTotal 
2022-1205

9.4

1927
2022-21458.511235
2022-39436.846453

 

But here whenever i add the "users" it spreadsout the "minutes" to each user which result to change the cost per minute

DateUserMinutesPer minuteTotal 
2022-1A

105

18.351927
2022-1B10019.271927
2022-2A45

27.44

1235
2022-2B10012.351235

 

Is there a better way to get "Per Minute" value based on "total" cost divided by the overall "Minutes" per month while ignoring the users then multiple the "per minute" to the "munites" used per "user?


Something like this

 

Base price per month

DateMinutesPer minuteTotal 
2022-1205

9.4

1927
2022-21458.511235
2022-39436.846453

 

 

DateUserMinutesPer minutetotal per userTotal 
2022-1A

105

9.49871927
2022-1B1009.49401927
2022-2A45

8.51

382.95

1235
2022-2B1008.518511235

 

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

Hi @JG00012 ,

Please try below steps:
1. below is my test table

Table:

vbinbinyumsft_0-1675748685350.png

2. create measure with below dax formula

Per Minutes =
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date] )
VAR _minutes =
    CALCULATE (
        SUM ( 'Table'[Minutes] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] = cur_date )
    )
VAR cur_total =
    SELECTEDVALUE ( 'Table'[Total] )
RETURN
    DIVIDE ( cur_total, _minutes )
Total Per User =
VAR per_minute = [Per Minutes]
VAR _minute =
    SELECTEDVALUE ( 'Table'[Minutes] )
RETURN
    per_minute * _minute

3. add table visual with fields and measure

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

2 REPLIES 2
v-binbinyu-msft
Community Support
Community Support

Hi @JG00012 ,

Please try below steps:
1. below is my test table

Table:

vbinbinyumsft_0-1675748685350.png

2. create measure with below dax formula

Per Minutes =
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date] )
VAR _minutes =
    CALCULATE (
        SUM ( 'Table'[Minutes] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] = cur_date )
    )
VAR cur_total =
    SELECTEDVALUE ( 'Table'[Total] )
RETURN
    DIVIDE ( cur_total, _minutes )
Total Per User =
VAR per_minute = [Per Minutes]
VAR _minute =
    SELECTEDVALUE ( 'Table'[Minutes] )
RETURN
    per_minute * _minute

3. add table visual with fields and measure

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

Thank you!
This help me out off my problem!

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.