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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.