Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Previous Month Reports Error in DAX

Hi Experts

 

Here are my measures in order to calculate the previous months reports... but i am getting zero... when i have values for the previous month in the data set...

Crime Report PM LM =
VAR LatestMonthSum =
CALCULATE ( SUM ( 'Test Data_'[cr03a_reportsmade] ),'Test Data_'[IsCurrentYear] = TRUE (),
FILTER(
'Test Data_',eomonth('Test Data_'[cr03a_period],0)
=[Latest Month] -1
)
)
 
Return
LatestMonthSum
 
Where 
Latest Month = eomonth(maxx(allselected('DimDate'), 'DimDate'[Date]),0)
6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , you are using 'Test Data_'[IsCurrentYear] = TRUE (), if the max month is an , then you will get null

 

You can check without that or try all on date

 

Crime Report PM LM =
VAR LatestMonthSum =
CALCULATE ( SUM ( 'Test Data_'[cr03a_reportsmade] ),
FILTER(
all('Test Data_'[cr03a_period]),eomonth('Test Data_'[cr03a_period],0)
=[Latest Month] -1 &&  'Test Data_'[IsCurrentYear] = TRUE ()
)
)

Return
LatestMonthSum

 

or

Crime Report PM LM =
VAR LatestMonthSum =
CALCULATE ( SUM ( 'Test Data_'[cr03a_reportsmade] ),
FILTER(
('Test Data_'[cr03a_period]),eomonth('Test Data_'[cr03a_period],0)
=[Latest Month] -1
)
)

Return
LatestMonthSum

Anonymous
Not applicable

Neither formula are working

@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

Hi Amit - did you get a chance to have a look at the sample data and question

Anonymous
Not applicable

Hi Amit the sample PBIC has Feb 21 data....

Anonymous
Not applicable

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.