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
CarlosOlmos29
Frequent Visitor

Filter data for a specific day of the month

Hello Power BI community.

Previously I had some data that was loaded with the last day of each month. I had the following measure:

Graph_dispersion_mes = CALCULATE(DIVIDE(sum(Table[Real Oil])-sum(Table[Plan Oil]),sum(Table[Plan Oil])),Table[Date]=EOMONTH(TODAY(),-1)).
Now the data is loaded with the 15th day of each month. That is, the January data is for 15-01-2023, the February data for 15-02-2023 and so on. I have used two different measures but none of them worked for me:

1. Graph_dispersion_mes = CALCULATE(DIVIDE(SUM(Actuals[OIL])-SUM(Plan[OIL]),SUM(Plan[OIL])), Date[Date]=DATE(2023,04,15)).
Graph_dispersion_mes = CALCULATE(DIVIDE(SUM(Actuals[OIL])-SUM(Plan[OIL]),SUM(Plan[OIL])), Date[Date]=max(actuals[date])).
I would like to know what is the mistake I am making, or if I am using the wrong time function.
I hope I have been clear with the explanation. Thank you very much in advance for your help.

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @CarlosOlmos29 ,

Your first attempt at a measure seems to be using a hard-coded date of April 15th, 2023. This would only work for that specific date and would not dynamically update as new data is added.

Your second attempt at a measure seems to be using the MAX function to get the latest date from the Actuals table, but it is not clear how this is being used in the context of the measure calculation.

To calculate the measure based on the 15th day of each month, you could modify the EOMONTH function in your original measure to use the 15th day of the previous month instead. For example:

 

Graph_dispersion_mes =
CALCULATE (
    DIVIDE (
        SUM ( Table[Real Oil] ) - SUM ( Table[Plan Oil] ),
        SUM ( Table[Plan Oil] )
    ),
    Table[Date]
        = DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 15 )
)

This would calculate the measure based on the 15th day of the previous month. You could also modify this to use a specific date if needed.

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @CarlosOlmos29 ,

Your first attempt at a measure seems to be using a hard-coded date of April 15th, 2023. This would only work for that specific date and would not dynamically update as new data is added.

Your second attempt at a measure seems to be using the MAX function to get the latest date from the Actuals table, but it is not clear how this is being used in the context of the measure calculation.

To calculate the measure based on the 15th day of each month, you could modify the EOMONTH function in your original measure to use the 15th day of the previous month instead. For example:

 

Graph_dispersion_mes =
CALCULATE (
    DIVIDE (
        SUM ( Table[Real Oil] ) - SUM ( Table[Plan Oil] ),
        SUM ( Table[Plan Oil] )
    ),
    Table[Date]
        = DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 15 )
)

This would calculate the measure based on the 15th day of the previous month. You could also modify this to use a specific date if needed.

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

 

Thanks you very much! It works perfect

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.