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
rosscortb
Post Patron
Post Patron

Apply previous month to Difference from Filtered Value Quick Measure

Hi, I am trying to count the previous month headcount after filtering out the "babcock - weekly" in the Payroll Area column. I can get this on current month but where do I apply the previous month? Thanks Ross Count of Payroll Area difference from Babcock - Weekly 2 = VAR __BASELINE_VALUE = CALCULATE( COUNTA('DB Headcount'[Payroll Area]), 'DB Headcount'[Payroll Area] IN { "Babcock - Weekly" } ) VAR __MEASURE_VALUE = COUNTA('DB Headcount'[Payroll Area]) RETURN IF(NOT ISBLANK(__MEASURE_VALUE), __MEASURE_VALUE - __BASELINE_VALUE)
1 ACCEPTED SOLUTION

@rosscortb

 

I can't see your sample data, so maybe my answer is not correct.

 

You can try below coding to see if you can count last month's amount.

 

VAR maxdate= max('date')

VAR lastmont=edate(maxdate,-1)

CCOUNTROWS(FILTER('DB Headcount',date=lastmonth && 'DB Headcount'[Payroll Area] <> "Babcock - Weekly"))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
rosscortb
Post Patron
Post Patron

Or can add I Previous Month to this, Measure = COUNTROWS(FILTER('DB Headcount','DB Headcount'[Payroll Area] <> "Babcock - Weekly"))

@rosscortb

 

I can't see your sample data, so maybe my answer is not correct.

 

You can try below coding to see if you can count last month's amount.

 

VAR maxdate= max('date')

VAR lastmont=edate(maxdate,-1)

CCOUNTROWS(FILTER('DB Headcount',date=lastmonth && 'DB Headcount'[Payroll Area] <> "Babcock - Weekly"))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hello

 

I managed to get this to work(sort of)

 

Meausure 4 = COUNTROWS(FILTER('DB Headcount','DB Headcount'[Payroll Area] <> "Babcock - Weekly" && PREVIOUSMONTH('Month'[Date])))
 
My figures started last April(I've no figures for this year yet just april - dec 2018) and the measure returns the value of number of rows minus april, so its not looking at the last month but at everything but the first month of my data which is april.

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.