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
amit_wairkar
New Member

Dividing with a count

Hi,

 

I have a column A which has an text data and column B which has Values. I want to check for a period of time the output.

 

eg - Delivery(value)/box(count) = Sum of column B / Count of Column A. In the data table what is happening is that it is taking the count as 1 and dividing with the value of column B. Hence the row wise result is coming same as the value of column B. I need an output which will calculate for a span of time, say if I take April and May and the delivery value is 40 and 60 resp. and the count is 3 & 2 resp. Then the output should show me 100/5 = 20. But currently as per the below calculation it is giving me an output 100.

= CALCULATE(SUM('[Table Name]'[Delivery])/DISTINCTCOUNT('[Table Name'[Box]))
 
Regards,
Amit Wairkar
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @amit_wairkar ,

Please try to update the formula of your measure as below and check whether it can get your expected result.

Measure = 
VAR _sumofdelivery =
    CALCULATE ( SUM ( 'Table'[Delivery] ), ALLSELECTED ( 'Table' ) )
VAR _countofbox =
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Box] ), ALLSELECTED ( 'Table' ) )
RETURN
    DIVIDE ( _sumofdelivery, _countofbox, 0 )

yingyinr_0-1628491435087.png

If the above one still can't get the correct result, please provide some sample data with Text format and some screenshots that how the visual looks like when you applied the measure.... Thank you.

Best Regards

Community Support Team _ Rena
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-yiruan-msft
Community Support
Community Support

Hi @amit_wairkar ,

Please try to update the formula of your measure as below and check whether it can get your expected result.

Measure = 
VAR _sumofdelivery =
    CALCULATE ( SUM ( 'Table'[Delivery] ), ALLSELECTED ( 'Table' ) )
VAR _countofbox =
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Box] ), ALLSELECTED ( 'Table' ) )
RETURN
    DIVIDE ( _sumofdelivery, _countofbox, 0 )

yingyinr_0-1628491435087.png

If the above one still can't get the correct result, please provide some sample data with Text format and some screenshots that how the visual looks like when you applied the measure.... Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ryan_mayu
Super User
Super User

@amit_wairkar 

maybe try

SUM('[Table Name]'[Delivery])/DISTINCTCOUNT('[Table Name'[Box]





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.