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

How Long Between Dates

Hi,

 

I am trying to create a visualization that shows Number of Open Leaks by day... 

 

In the WR_NO below, the leak was open from 4/2/2017-4/17/2017. 

 

When putting it into a graph, it only shows the Date_Opened Date, and the number of days it was "Open"...

Is there a way to show the leak being open on 4/2 thru 4/17? So, for the dates 4/2-4/17, the value would be 1... and I would do this for all WR_NO's, so the values displayed in the visual would be the days that the WR_NO's are open

 

Capture.PNG

Capture2.PNG

Please let me know if this question does not make sense

 

Thank you!
Sarah

1 ACCEPTED SOLUTION
9 REPLIES 9
Anonymous
Not applicable

hi @amitchandak this is amazing! the only issue i am running into is that it will not allow me to display multiple WRs...

 

for example, in the below screenshot, i have created measures like you had shown me, and it displays the Sum of Days from 3/13-3/31.

 

when I add another WR# with the same date range to test it, it does not show anything... is there a way to display multiple WR_NOs in one visualization with the sum of days for those WR_NOs?

 

 

I eventually want to create a bar chart displaying dates on the x-axis and sum of days on the y axis

 

thank you!
Sarah

Anonymous
Not applicable

sorry the screenshots were not attached

please see below

 

Capture.PNG

 

Capture2.PNG

@Anonymous , Which one you used. I shared two test cases. please share the formula. Better is that if you can share a few rows of data in table format. We will try to provide the formula based on that.

 

 

Anonymous
Not applicable

@amitchandak , These are the formulas I used:

 

Completed WRss = CALCULATE(COUNT(Query1[WR_NO]),USERELATIONSHIP(Query1[REPAIR_DATE],'2014 to Present'[Date]),not(ISBLANK(Query1[DATE_OPENED])))
 
Current Open Wrss = CALCULATE(COUNTx(FILTER(Query1,Query1[DATE_OPENED]<=max('2014 to Present'[Date]) && (ISBLANK(Query1[DATE_OPENED]) || Query1[REPAIR_DATE]>max('2014 to Present'[Date]))),(Query1[WR_NO])),CROSSFILTER(Query1[DATE_OPENED],'2014 to Present'[Date],None))
 
WRss? = CALCULATE(COUNT(Query1[WR_NO]),USERELATIONSHIP(Query1[DATE_OPENED],'2014 to Present'[Date]) )
 
WR Changee% = if(not(ISBLANK([Last Year WRss?] )),CALCULATE( (divide([Current Open Wrss],[Last Year WRss?] ) -1)*100))
 
Days for WR = [Current Open Wrss]+[Completed WRss]
 
Sum days = sumx('2014 to Present',[Days for WR])
 
In the table, I am only using the "Sum days" formula, because this displays the values that I want
Anonymous
Not applicable

Anonymous
Not applicable

WR_NOREPAIR_DATEDATE_OPENED 
35991014/2/2020 0:003/23/2020 0:00 
35974934/1/2020 0:003/15/2020 0:00 
35974854/1/2020 0:003/14/2020 0:00 
35983914/1/2020 0:003/17/2020 0:00 
35972193/31/2020 0:003/12/2020 0:00 
35974873/31/2020 0:003/13/2020 0:00 
35975583/31/2020 0:003/13/2020 0:00 
35968363/30/2020 0:003/11/2020 0:00 
35972493/27/2020 0:003/10/2020 0:00 
       
        
        

 

@amitchandak here is some sample data

@Anonymous ,

Please find the attached solution after the signature. 

Greg_Deckler
Super User
Super User

Not certain, but it sounds like you want Open Tickets, it was designed to work with date intervals.

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/td-p/409364


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

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.