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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
talitanieps
Advocate I
Advocate I

Need help to sum rows based on date

Hello Community!

I'm having a hard time figuring out how to do this, and I tried several DAX codes already with no correct result...
I have a table which we can see below:

talitanieps_0-1677864377132.png

 

It shows the follower gain by day, by account; I also have a Calendar table related to this table in a1:* relationship.
What hapens is that I want to show, in a card, the amount of followers gained in a given period of time (responding to filters) and according to each account (here represented by A, B, C, D, E). 

So,  how can I show the followers change, considering:
- the 'account' filter
- the date filter, which I'm using a 'between' one, with d_calendar [date] field on it.


I appreciate the help on this! Thanksssss


2 REPLIES 2
FreemanZ
Super User
Super User

hi @talitanieps 

supposing the calendar is related with the start column, try like:
 
Measure =
SUMX(
    FILTER(
        TableName,
        TableName[Start]<=MAX(d_calendar[Date])&&TableName[Start]>=MIN(d_calendar[Date])
)
    TableName[gain]
)

Heey @FreemanZ ,

Thanks for the reply! 
I tried it and it's not working.... it's asking for more arguments on SUMX function... Trying to make it work on my end, though! 🙂

One of the DAX structures I tried included a filter similar to the one you provided... made another test with:


var _firstDate = FIRSTDATE(d_Calendar[Date])
var _lastDate = LASTDATE(d_Calendar[Date])

var _FollowerGain =           CALCULATE(
                                        SUMX ( Table, Table[organicFollowerGain]) ,
                                            FILTER( Table,
                                                    Table[start]<=_firstDate && Table[start]>=_lastDate
                                                                     
                                            ) Table [organizationalEntity] = SELECTEDVALUE( Media_Table[account_id] )
                                            ) +0

RETURN _FollowerGain

But, alas, it keeps me returning 0, when, if you take the print I shared, the result should be 497. 😞
I worked my way backwards, removing the filters, and there's something about the date Power BI doesn't seem to be getting right; whenever I leave the OrganizationalEntity filter....... 




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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
Top Kudoed Authors