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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
DeEviloN
Helper III
Helper III

Monthly amount based on the last date of the application

Good day! Tell me how you can summarize the data for a month, based on the last date of his application?

I have the most recent date, for example 10/15/21, how can I sum all 10 months and compare with the previous month where the user was reported? for example - it was 10/15/21 and 08/02/2021, how to force the comparison of the amount for 10 months with the amount for 8 months?

1 ACCEPTED SOLUTION

@DeEviloN , Do you YTD from last date ?

 

example

 

YTD=
var _max = maxx(allselected('Table'),'Table'[date])
var _min = date(_max),1,1)

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _max) )

 

Assumed you have date table or filer table[Date]

 

or

CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >=_min && 'Table'[Date] <= _max) )

 

or

 

CALCULATE(sum('Table'[Qty]), FILTER(('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _max) )

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

6 REPLIES 6
v-luwang-msft
Community Support
Community Support

Hi @DeEviloN ,

Since your data is not regular, you cannot use dax sort to get to the last one. You need to add indexes via Power Query as an aid.

Step1, add index,then close and apply:

vluwangmsft_0-1637829305828.png

Step 2,try the measure ,to get last ereryday value:

lastsaleeverydate =
IF (
    CALCULATE (
        MAX ( 'Table'[Index] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Users] = MAX ( 'Table'[Users] )
                && 'Table'[Data] = MAX ( 'Table'[Data] )
        )
    )
        = MAX ( 'Table'[Index] ),
    MAX ( 'Table'[Sales] ),
    0
)

Output:

vluwangmsft_1-1637829898531.png

Then use the sumx to compare value:

sumx = SUMX(FILTER(ALL('Table'),'Table'[Users]=MAX('Table'[Users])&&'Table'[Data]<=MAX('Table'[Data])),'Table'[lastsaleeverydate])

You will get the sum value:

vluwangmsft_2-1637830080526.png

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

DeEviloN
Helper III
Helper III

 last date 

UsersDataSales
User11.8270,00
User12.8270,00
User12.84560,00
User12.8540,00
User12.8540,00
User12.81090,00
User12.85910,00
User110.10660,00
User110.101080,00
User112.101260,00
User113.1011220,00
User114.1030,00
User115.1060,00
User115.10160,00
User115.10180,00
DeEviloN
Helper III
Helper III

UsersDataSales
User11.8270,00
User12.8270,00
User12.84560,00
User12.8540,00
User12.8540,00
User12.81090,00
User12.85910,00
User110.10660,00
User110.101080,00
User112.101260,00
User113.1011220,00
User114.1030,00
User115.1060,00
User115.10160,00
User115.10180,00
DeEviloN
Helper III
Helper III

Sorry, corrected the text

Good day! Tell me how you can summarize the data for a month, based on the last date of his application?

I have the most recent date, for example 10/15/21, how to sum this 10 month and compare with the previous month where the user was reported? for example - it was 10/15/21 and 08/02/2021, how to force the comparison of the amount for 10 months with the amount for 8 months?

@DeEviloN , Do you YTD from last date ?

 

example

 

YTD=
var _max = maxx(allselected('Table'),'Table'[date])
var _min = date(_max),1,1)

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _max) )

 

Assumed you have date table or filer table[Date]

 

or

CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >=_min && 'Table'[Date] <= _max) )

 

or

 

CALCULATE(sum('Table'[Qty]), FILTER(('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _max) )

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

It still doesn't work, I wanted to compare based on the last month of delivery of the client's products and the previous month of his delivery to determine its category

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors