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

Dax measure to exclude current month

Hi 

 

I have a line graph which has to measures in it to show the trend for Penetration - however i need to duynamically exclude current month 
is there a way to do that?

This is the original measure and the same is done for UK 
IE Pen =
DIVIDE(SUM(' IE'[Sales ]),SUM(' IE'[reg]),0)
1 ACCEPTED SOLUTION
isabella
Employee
Employee

Hi @Anonymous 

 

I did a local test ,you can take a reference 

 

Here is my test  table

isabella_0-1656399288449.png

 

 

 

 

First I created a calendar table

isabella_1-1656399288450.png

 

Then create a one-to-one relationship between these two tables

 

isabella_2-1656399288451.png

 

 

Then I create the measure

IE Pen = DIVIDE(SUM('Table'[sales]),SUM('Table'[reg]),0)

Then I create the measure

Measure = CALCULATE([IE Pen],FILTER('calendar', (10*YEAR('calendar'[Date])+'calendar'[Date].[MonthNo]) < (10*YEAR(TODAY())+MONTH(TODAY()))))

 

Then in visualization,I create a line chart

isabella_3-1656399288452.png

 

 

 

We can see from the line chart ,there is no data in June  2022

 

isabella_4-1656399288453.png

 

 

If we change the graph  to table,we can  also see that  the current month data is excluded

 

isabella_5-1656399288454.png

 

 

Best Regards,

Community Support Team _Isabella

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
isabella
Employee
Employee

Hi @Anonymous 

 

I did a local test ,you can take a reference 

 

Here is my test  table

isabella_0-1656399288449.png

 

 

 

 

First I created a calendar table

isabella_1-1656399288450.png

 

Then create a one-to-one relationship between these two tables

 

isabella_2-1656399288451.png

 

 

Then I create the measure

IE Pen = DIVIDE(SUM('Table'[sales]),SUM('Table'[reg]),0)

Then I create the measure

Measure = CALCULATE([IE Pen],FILTER('calendar', (10*YEAR('calendar'[Date])+'calendar'[Date].[MonthNo]) < (10*YEAR(TODAY())+MONTH(TODAY()))))

 

Then in visualization,I create a line chart

isabella_3-1656399288452.png

 

 

 

We can see from the line chart ,there is no data in June  2022

 

isabella_4-1656399288453.png

 

 

If we change the graph  to table,we can  also see that  the current month data is excluded

 

isabella_5-1656399288454.png

 

 

Best Regards,

Community Support Team _Isabella

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@isabella Hi thanks for your help
The formula worked perfectly - however im trying to replicate it for UK now and UK pen is exactly the same as IE pen formula however it will not exclude current month

Anonymous
Not applicable

Maleehah_0-1657019295984.png

 

rajulshah
Super User
Super User

Hello @Anonymous ,

 

Please try the following measure and let me know if it works:

IE Pen Current Month = 
CALCULATE(
    [IE Pen], 
    FILTER('Calendar',MONTH('Calendar'[Dates]) = MONTH(TODAY())),
    FILTER('Calendar',YEAR('Calendar'[Dates]) = YEAR(TODAY()))
    )
Anonymous
Not applicable

Hi - no that does work thank you 

 

I need the measure to show everything except for Current month 

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.