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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
kwats
Frequent Visitor

Sum Column but Skip First Month for Each Tenant

I have the following table below called Commercial Retail Sales and I'm trying to sum the 'Sales MTD' column after excluding the first month for each tenant. I tried the DAX formula below but it just sums up everything the same as Total Sales MTD = SUM( 'Commercial Retail Sales'[Sales MTD] ).

 

Total Sales MTD Without First Month =
VAR FirstMonth =
CALCULATE (
SUM( 'Commercial Retail Sales'[Sales MTD]),
DATESBETWEEN( 'Commercial Retail Sales'[Date], MIN( 'Commercial Retail Sales'[Date]) + 1, MAX( 'Commercial Retail Sales'[Date] ) )
)
RETURN

SUMX(
SUMMARIZE( 'Commercial Retail Sales', 'Commercial Retail Sales'[Tenant], "First Full Month", FirstMonth ),
[First Full Month]
)

I've been working on this for days and nights. Any help would be greatly appreciated! Thanks. Here's the data:

Date Tenant Sales MTD
5/31/2019 Tenant One $17,150
6/30/2019 Tenant One $96,261
7/31/2019 Tenant One $99,758
8/31/2019 Tenant One $88,102
9/30/2019 Tenant One $51,561
10/31/2019 Tenant One $47,480
11/30/2019 Tenant One $46,613
12/31/2019 Tenant One $57,197
1/31/2020 Tenant One $35,794
2/29/2020 Tenant One $43,086
3/31/2019 Tenant Two $5,077
4/30/2019 Tenant Two $91,166
5/31/2019 Tenant Two $93,417
6/30/2019 Tenant Two $89,959
7/31/2019 Tenant Two $90,011
8/31/2019 Tenant Two $92,519
9/30/2019 Tenant Two $85,027
10/31/2019 Tenant Two $89,492
11/30/2019 Tenant Two $94,165
12/31/2019 Tenant Two $112,937
1/31/2020 Tenant Two $101,008
2/29/2020 Tenant Two $94,330
5/31/2019 Tenant Three $11,752
6/30/2019 Tenant Three $29,620
7/31/2019 Tenant Three $34,719
8/31/2019 Tenant Three $38,345
9/30/2019 Tenant Three $37,270
10/31/2019 Tenant Three $32,755
11/30/2019 Tenant Three $39,677
12/31/2019 Tenant Three $32,127
1/31/2020 Tenant Three $31,074

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Hi, @kwats , you may want to try this measure

Total Sales MTD Without First Month = 
SUMX (
    DISTINCT ( 'Commercial Retail Sales'[Tenant] ),
    SUMX (
        FILTER (
            DISTINCT ( 'Commercial Retail Sales'[Date] ),
            'Commercial Retail Sales'[Date]
                > CALCULATE (
                    MIN ( 'Commercial Retail Sales'[Date] ),
                    ALLEXCEPT ( 'Commercial Retail Sales', 'Commercial Retail Sales'[Tenant] )
                )
        ),
        [Total Sales MTD]
    )
)

Screenshot 2020-10-19 020409.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@kwats , Try like

calculate( sum(Sales MTD), filter( allselected(Table]), Table[Tenant] = max(Table[Tenant])  && Table[Date] >eomonth(min(Table[Date],0))))

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
CNENFRNL
Community Champion
Community Champion

Hi, @kwats , you may want to try this measure

Total Sales MTD Without First Month = 
SUMX (
    DISTINCT ( 'Commercial Retail Sales'[Tenant] ),
    SUMX (
        FILTER (
            DISTINCT ( 'Commercial Retail Sales'[Date] ),
            'Commercial Retail Sales'[Date]
                > CALCULATE (
                    MIN ( 'Commercial Retail Sales'[Date] ),
                    ALLEXCEPT ( 'Commercial Retail Sales', 'Commercial Retail Sales'[Tenant] )
                )
        ),
        [Total Sales MTD]
    )
)

Screenshot 2020-10-19 020409.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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