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

Dax Measure to Count No of Days with Condition

Hi,

I'm new in DAX, and I'm having a problem in counting the number of days with a condition. I need a measure that will count the days passed from the slicer date where the GL OB is more than the Amort OB and will stop the count if there will be a date where the Amort OB is more than equal the GL OB. Please see the table below (The No. of days column is the result of the measure I needed):

 

DateAmort OBGL OBNO OF DAYS
Sep-1910,00012,0000
Oct-198,0008,0000
Nov-196,0008,00031
Dec-194,0008,00061
3 REPLIES 3
sherisamoore
New Member

Can someone assist me. I am pulling the bug report from azure DevOps to power BI. When I add the defect count to a month chart, it is showing the defects incremented each month. What I need is for the count of defects displayed to start over each month. So if January and February had 250 defects. January should display 125 and February should display 125 not January shows 125 and February shows 250 and the data shows the increase between months and not how many each month. Please help!!
Anonymous
Not applicable

@Peejz_Jalmasco 

Could not solve in one measure. Created a column and measure
First column: If amount GL OB is greater then Amort OB

IsGLgtOB = IF(Test[GL OB]>Test[Amort OB],1)
Second measure = date difference
NoOfDays =
VAR CurrentDate = MAX(Test[Date])
VAR OB = CALCULATE(SUM(Test[Amort OB]),Test[Date]=CurrentDate)
VAR PrevDate = CALCULATE(MAX(Test[Date]),Test[IsGLgtOB]=0,Test[Date]<CurrentDate)
RETURN IF(MAX(Test[IsGLgtOB])=1,DATEDIFF(PrevDate,CurrentDate,DAY),0)

Can this be solve without adding a column?

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.

Top Solution Authors