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
Cyrilbrd
Helper IV
Helper IV

February 2021 and calculations

Good day, 

I have noticed that February 2021 was displaying some unusual values.
After reading the blog "DAX Time intelligence and the 29th of February – #PowerBI" I discovered that I might be using the wrong approach to get the information I need.

Table required:
1.PNG

As seen above I need to show per day the cumulative sales last month, the cumulative sales this month and the ratio.
The measures are as follows:

MTD_LM = CALCULATE([Actual],
DATEADD(filter(DATESMTD(Date_table[Date]),Date_table[Date]<=today()),-1,MONTH))
 
MTD = TOTALMTD([Actual],Date_table[Date])
 
MTD_var = divide([MTD],[MTD_LM],"")
 
I noticed that the table was however returing incorrect values for Feb 29th ,30th and 31st.
It should be blank and yet as describe by Erik Svensen, my measures are returning values. 
2.PNG
As seen above 29th 30th and 31st are showing values.

Anyone could guide me, I am sure that the measures are wrong and might need tweeking.
Thanks.
1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @Cyrilbrd,

 

Try measure as:

Measure = 
CALCULATE(
    SUM('Table'[Column2]),
    PREVIOUSMONTH('Table'[Column1]))

Here is the output:

v-xulin-mstf_0-1612508798497.png

 

Best Regards,

Link

View solution in original post

3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

Hi @Cyrilbrd,

 

Try measure as:

Measure = 
CALCULATE(
    SUM('Table'[Column2]),
    PREVIOUSMONTH('Table'[Column1]))

Here is the output:

v-xulin-mstf_0-1612508798497.png

 

Best Regards,

Link

amitchandak
Super User
Super User

@Cyrilbrd , Have you tried like

 

last MTD Sales = CALCULATE([Actual],DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

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

sorry this is still displaying data for 29, 30 and 31.

data comes from server via mysql so no sample available here.

would you need anything else?

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.