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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

datediff function not giving proper value

Hi ,

 I am converting tableau report in power bi . While converting taleau formula i am facing some issue. The tableau formula is - Total Rig days = datediff('second',{include [Job Number]: min([Date In])}, {INCLUDE [Job Number]: max([Date Out])})

I converted in power bi like this -

Total Rig Day = DATEDIFF({AVERAGEX(SUMMARIZE(sp_ftl_dbm_tfs_summ_v2_sn,sp_ftl_dbm_tfs_summ_v2_sn[Job Number], "Date",min(sp_ftl_dbm_tfs_summ_v2_sn[min_date_in])),[Date]),({AVERAGEX(SUMMARIZE(sp_ftl_dbm_tfs_summ_v2_sn,sp_ftl_dbm_tfs_summ_v2_sn[Job Number],"Date", max(sp_ftl_dbm_tfs_summ_v2_sn[max_date_out])),[Date])}),SECOND) 
But it is not giving the proper result . I tried in measre and calculated column both . While trying with sumx function giving me invalid numerical representation error.
Please help to correct it.
 
Thanks.
1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create measure like DAX below.

 

Open Count=

Var _MinDate = CALCULATE(MIN('sp_ftl_dbm_tfs_summ_v2_sn'[Date in]), ALLEXCEPT('sp_ftl_dbm_tfs_summ_v2_sn', 'sp_ftl_dbm_tfs_summ_v2_sn'[Job number]))

Var _MaxDate = CALCULATE(MAX('sp_ftl_dbm_tfs_summ_v2_sn'[Date Out]), ALLEXCEPT('sp_ftl_dbm_tfs_summ_v2_sn', 'sp_ftl_dbm_tfs_summ_v2_sn'[Job number]))

Return

DATEDIFF(_MinDate, _MaxDate, SECOND)

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create measure like DAX below.

 

Open Count=

Var _MinDate = CALCULATE(MIN('sp_ftl_dbm_tfs_summ_v2_sn'[Date in]), ALLEXCEPT('sp_ftl_dbm_tfs_summ_v2_sn', 'sp_ftl_dbm_tfs_summ_v2_sn'[Job number]))

Var _MaxDate = CALCULATE(MAX('sp_ftl_dbm_tfs_summ_v2_sn'[Date Out]), ALLEXCEPT('sp_ftl_dbm_tfs_summ_v2_sn', 'sp_ftl_dbm_tfs_summ_v2_sn'[Job number]))

Return

DATEDIFF(_MinDate, _MaxDate, SECOND)

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

 

mahoneypat
Microsoft Employee
Microsoft Employee

Please post example mock data and desired output.  I suspect your DAX expression can be much shorter than how you've started.

 

Regards,

Pat

 

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Data is like this -

 

Job number   Date in            Date Out          

17 CG 10       20/07/2019     25/09/2019

17 Fv  11        22/08/2019     28/10/2019

 

Total rigs day comes in tableau -          but in power bi 

14,589                                                    170,296,584

16,830                                                    186,345,256

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.