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
Anonymous
Not applicable

Divide two columns DAX

Hello guys,

 

I have created three calculated columns :

 

DIFFERENCEINDAYSV2 = DATEDIFF(aWORKFLOWWORKITEMTABLE[CREATEDDATETIME],aWORKFLOWWORKITEMTABLE[TODAY],MINUTE)/1440

 

COUNTRECID =

COUNT(aWORKFLOWWORKITEMTABLE[RECID])

 

LEADTIME =

aWORKFLOWWORKITEMTABLE[DIFFERENCEINDAYSV2] / aWORKFLOWWORKITEMTABLE[COUNTRECID]

 

and then i created a table for showing the data based on these 3 colums based on a Userid.

 

In the following image i expect that the LEADTIME calculated column return from the first row is 25 and not 0.04.

 

what did i wrong? any suggestions?

 

 

2018-02-19 16_03_21-Analysis Doorlooptijden backlog 2995_20180208 - Power BI Desktop.png

 

1 ACCEPTED SOLUTION

@Anonymous

 

I think you should create a MEASURE instead of Calculated Column

 

LEADTIME =

Sum(aWORKFLOWWORKITEMTABLE[DIFFERENCEINDAYSV2]) / sum(aWORKFLOWWORKITEMTABLE[COUNTRECID])

 

I believe...With a calculated column, division occurs first and then the results are summed in a Table Visual. Thats why it gives you inaccurate results


Regards
Zubair

Please try my custom visuals

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

Can you share some example raw data so that we can recreate what is going on here?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello ,

 

as you can see the total of these three columns is correct because  28172 / 566 = 49.77. The issue is that the expected result for each rows doesnt work.  on the first row i expected 46.57 and not 8.80.

 

How can i divide each rows in the good way between column DIFFERENCEINDAYSV2 and ACTIVITYID?

 

2018-02-21 11_42_36-Analysis Doorlooptijden backlog 2995_20180208 - Power BI Desktop.png

 

 

@Anonymous

 

I think you should create a MEASURE instead of Calculated Column

 

LEADTIME =

Sum(aWORKFLOWWORKITEMTABLE[DIFFERENCEINDAYSV2]) / sum(aWORKFLOWWORKITEMTABLE[COUNTRECID])

 

I believe...With a calculated column, division occurs first and then the results are summed in a Table Visual. Thats why it gives you inaccurate results


Regards
Zubair

Please try my custom visuals

 Your calcualtion should be

 

LEADTIME =

 aWORKFLOWWORKITEMTABLE[COUNTRECID]/aWORKFLOWWORKITEMTABLE[DIFFERENCEINDAYSV2] 

or Use  Divide(aWORKFLOWWORKITEMTABLE[DIFFERENCEINDAYSV2] , aWORKFLOWWORKITEMTABLE[COUNTRECID)

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.