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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
gbarr12345
Post Prodigy
Post Prodigy

Trying to create a measure for the Sales Contribution for just January

Hi everyone,

 

I'm trying to create a measure that shows the Sales Contribution for just the month of Janaury but it's returning all months and not just January as per the screenshot below.

 

Can anybody spot where I'm going wrong with my measure? Please see it below.

 

The year is 2015 as that's what the sample data set provided.

 

Many Thanks in advance.

 

Sales Contribution January =
VAR StartDate = DATE(2015, 1, 1)
VAR EndDate = DATE(2015, 1, 30)
RETURN
CALCULATE(
    [Total Sales],
    FILTER(
        DateTable,
        DateTable[Date] >= StartDate &&
        DateTable[Date] <= EndDate &&
        DateTable[Date] >= DATE(2015, 1, 1)
    ),
    ALLEXCEPT(Orders, Orders[Customer Name])
)

 

gbarr12345_0-1714425049253.png

 

 

2 REPLIES 2
vicky_
Super User
Super User

There's two easy options - first is to create a new column in your Date table for the month and put that in the slicer. The other would be to add a line to the filter statement for the month. something like:

    FILTER(
        DateTable,
        ...
        MONTH(DateTable[Date]) = 1
    ),

Thank you for the response and your help 🙂

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!