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

Count increase/decrease over time frame

I was tasked to build a formula letting us know how the month is tracking as far on inputs vs the past 12 months average.

 

The data is like the following

 

Table name: WO

two columns:

"doc_no,   Date"

 

The example would be today is Dec 13th.  There will be 10 unique dates in the table for this month because we are closed on weekends.  We have had 50 inputs(Doc_no) so far this month.  That is 5 a day for this month......50 inputs/10 unique dates.

 

Now, for the past 12 months, there has been 251 unique dates in the table...no weekends...no holidays.....  In that time we have had 2008 inputs(doc_no).  That is 8 a day for the past 12 months........2008 inputs/251 unique dates.

 

Thus, the result of my formula would be we are tracking down 37.5% in inputs for the month.....5 a day this month so far vs. 8 a day average the past 12 months = we are down -37.5% in inputs so far this month.

 

I have a date dimensions table joined to the date field in the WO table.   I attached an image of the datedimension table

 

Any ideas and thanks for the help!  The doc_no will be distinct in the table so no need to include this in the formula.  The formula below is what I have so far but I don't think I'm even close.

 

input% = DIVIDE(calculate(count('WO'[DOC_NO]),'DateDimension''[CurrentMonth])  ????  DIVIDE(count('WO'[DOC_NO]),countdistinct('WO'[Date]

 

Capture.PNG

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Here is what I am thinking:

 

intput% = DIVIDE(CALCULATE(COUNT('WO'[DOC_NO]),MONTH('WO'[Date])=MONTH(TODAY())),CALCULATE(DISTINCTCOUNT('WO'[Date]),MONTH('WO'[Date])=MONTH(TODAY())))

That would get you this month, you would change the filter criteria for the last 12 months. 

 

 


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

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Here is what I am thinking:

 

intput% = DIVIDE(CALCULATE(COUNT('WO'[DOC_NO]),MONTH('WO'[Date])=MONTH(TODAY())),CALCULATE(DISTINCTCOUNT('WO'[Date]),MONTH('WO'[Date])=MONTH(TODAY())))

That would get you this month, you would change the filter criteria for the last 12 months. 

 

 


@ 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

I got everything to work.  Thank you sir!

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.