cancel
Showing results for
Did you mean:
Helper I

## calculation using current month

Hi All,

Is there a way to calculate a simple measure like, total count of something (filings) but in a way that it dynamically updates with the current month of the data. For example, I have this measure in a visual card, and right now it displays total filings for July 2021, when the data comes in for August, the card will update automatically and display the total for August, then eventually September when that data comes in, etc......

1 ACCEPTED SOLUTION
Helper I

Hi Greg, @Greg_Deckler I am having success with this:

Value on Last Year/Month =
CALCULATE(
COUNT( 'JBSIS Probate Filings'[Case Number] ),
FILTER( 'JBSIS Probate Filings', 'JBSIS Probate Filings'[Report Year Month] = MAX( 'JBSIS Probate Filings'[Report Year Month] ) )
)
5 REPLIES 5
Super User IV

@pfarahani So generally, the way this is done is to create a calculated column like the following:

``````Column IsCurrentMonth =
VAR __Today = TODAY()
VAR __CurrentYear = YEAR(__Today)
VAR __CurrentMonth = MONTH(__Today)
VAR __Year = YEAR('Table'[Date])
VAR __Month = MONTH('Table'[Date])
RETURN
IF(__Year = __CurrentYear && __Month = __CurrentMonth,1,0)

Column IsCurrentMonth Alternate =
VAR __CurrentEOMonth = EOMONTH(TODAY(),0)
VAR __EoMonth = EOMONTH([Date],0)
RETURN
IF __EoMonth = __CurrentEoMonth, 1, 0)``````

Then you can filter your visual on this column = 1

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Helper I

Hi Greg, @Greg_Deckler  - my bad, I looked more closely at the data in this dashboard, its a little but different. There is this filings table, I am trying to create a measure to count total filings based on the last/max month-year in this dataset, which right now is December of 2019

Super User IV

``````Column IsCurrentMonth =
VAR __MaxYear = MAX('Table'[Report Year])
VAR __MaxMonth = MAXX(FILTER('Table',[Report Year] = __MaxYear),[Report Month])
RETURN
IF([Report Year]=__MaxYear && [Report Month]=__MaxMonth,1,0)``````

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Helper I

Hi Greg, @Greg_Deckler I am having success with this:

Value on Last Year/Month =
CALCULATE(
COUNT( 'JBSIS Probate Filings'[Case Number] ),
FILTER( 'JBSIS Probate Filings', 'JBSIS Probate Filings'[Report Year Month] = MAX( 'JBSIS Probate Filings'[Report Year Month] ) )
)
Super User IV

@pfarahani Yep, I can see how that would work too!

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Announcements

#### 2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

#### Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

#### Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors