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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
gbarr12345
Helper V
Helper V

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.