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
RenateBK
Helper I
Helper I

Can you filter out specific months of your choice in a year?

Hello, 

 

I am working with a fact table where there's a column for sales and one column for the budgetted sales, with the timespan from 2012-2022. The budget column is filled out till December 2022, but currently I have only received data until October for actual sales. As there is no data for November/December 2022 yet I would like to filter out these months, but I can't seem to find a filter where I can filter out specific months in a specific year. 

 

I have tried to create my own formulas, but both have pros/cons. 

My first one is filtering out rows in my budgetted sales column if there is 0 in the same row under sales column. 

 

Measure =
CALCULATE(
    SUM(Table[Budget]),
    FILTER(
        Table,
        NOT(Table[Sales] IN {0})
    )
)
 
However, there's a running risk of the input of sales being 0 once and then it will be filtered out when it should be included.  
 
The second solution is using an IF filter. First I create two columns in the date table. First column identifies end of month day, then in the second column I use the IF function to create a boolean filter which I then apply in the dashboard.  
 
LastDateofMonth = ENDOFMONTH(dDato[Date])
IsFutureMonth = IF(TODAY() > dDato[LastDateofMonth], 1, 0)
 
However, the issue here is that if I receive the data for sales later than said month (e.g. I am still lacking November data and we're in December), the filter will still include November in my model and obscure the numbers. 
 
Thus, I was wondering if there is a better/simpler way of filtering out specific months in a year. 
 
Thank you, 
Renate
1 ACCEPTED SOLUTION
Aburar_123
Resolver IV
Resolver IV

Hi @RenateBK ,

 

You can write the measure as below if you maintain the Sales value as Null for unreceived months,

 

Measure =
CALCULATE(
    SUM(Table[Budget]),
    FILTER(
        Table,
        Table[Sales] <> Blank()
    )
)
 
 
Please Accept this as a solution if it solves your Problem. Thanks

View solution in original post

2 REPLIES 2
RenateBK
Helper I
Helper I

Thank you for the solution, that makes a lot of sense!

I'll make sure to keep the sales value as null for unreceived months moving onwards. 

 

Aburar_123
Resolver IV
Resolver IV

Hi @RenateBK ,

 

You can write the measure as below if you maintain the Sales value as Null for unreceived months,

 

Measure =
CALCULATE(
    SUM(Table[Budget]),
    FILTER(
        Table,
        Table[Sales] <> Blank()
    )
)
 
 
Please Accept this as a solution if it solves your Problem. Thanks

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.