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
Aliafshari
Frequent Visitor

sum before a day

Hi everyone!

 Assume that I have selected Year, Month and Day in slicer in below tale, I would like to sum the Quantity before the selected time dimension, How could I do that?

 

Date                      year            month           day              Quantity

1/1/200920091179
1/2/200920091229
1/3/200920091391
1/4/200920091478
1/5/200920091510
1/6/200920091677
1/7/200920091767
1/8/200920091822
1/9/200920091991
1/10/2009200911067
1/11/2009200911196
1/12/2009200911229
1/13/2009200911397
1/14/2009200911499
1/15/2009200911554
1/16/2009200911691
1/17/2009200911776
1/18/2009200911890
1/19/2009200911963
1/20/2009200912058
1/21/2009200912116
1/22/2009200912220
1/23/2009200912319
1/24/2009200912422
1/25/2009200912513
1/26/2009200912694
1/27/2009200912741
1/28/2009200912890
1/29/2009200912957
1/30/2009200913018
1/31/2009200913136
2/1/200920092150
2/2/200920092280
2/3/200920092315
2/4/200920092498
2/5/200920092542
2/6/200920092647
2/7/200920092719
2/8/200920092874
2/9/200920092930
2/10/2009200921024
2/11/2009200921185
2/12/2009200921271
2/13/20092009213100
2/14/2009200921477
2/15/2009200921526
2/16/2009200921689
2/17/2009200921711
2/18/2009200921898
2/19/20092009219100
2/20/2009200922076
2/21/2009200922132
2/22/2009200922241
2/23/2009200922387
2/24/2009200922423
2/25/2009200922533
2/26/2009200922644
2/27/2009200922790
2/28/2009200922869
3/1/200920093184
3/2/200920093261
3/3/200920093375
3/4/200920093495
3/5/200920093559
3/6/200920093681
3/7/200920093759
3/8/200920093880
3/9/200920093914
3/10/2009200931068
3/11/2009200931198
3/12/2009200931220
3/13/2009200931392
3/14/2009200931432
3/15/2009200931539
3/16/2009200931643
3/17/2009200931765
3/18/2009200931814
2 ACCEPTED SOLUTIONS

Hi @Aliafshari

 

When you select a YEAR, a MONTH and a DAY, result would be a single date

SELECTEDVALUE pulls that date

 

see the attached file with your sample data

 

 


Regards
Zubair

Please try my custom visuals

View solution in original post

8 REPLIES 8
Zubair_Muhammad
Community Champion
Community Champion

Hi @Aliafshari

 

Try this MEASURE

Sum_Before_Selected_Day =
CALCULATE (
    SUM ( TableName[Quantity] ),
    FILTER (
        ALL ( TableName ),
        TableName[Date] < SELECTEDVALUE ( TableName[Date] )
    )
)

Regards
Zubair

Please try my custom visuals

Hi Zubair_Muhammad

 

Thanks for youre notice, Youre measure only depend on Date but I really want to first select Year, month and then day, how to add this filters in youre measure?

Hi @Aliafshari

 

When you select a YEAR, a MONTH and a DAY, result would be a single date

SELECTEDVALUE pulls that date

 

see the attached file with your sample data

 

 


Regards
Zubair

Please try my custom visuals

Thank you Zubair_Muhammad 

Sorry  Zubair_Muhammad 

One more question, Consider we add a column name as Main account, how to sum before a day for each of main account in a table?

 

 

Date          Main account        Quantity

 **                      **                     **

HI @Aliafshari

 

In that case use this MEASURE. Then drag it to the TABLE visual along with the account names

 

Sum_Before_Selected_Day =
CALCULATE (
    SUM ( TableName[Quantity] ),
    FILTER (
        ALLEXCEPT ( TableName, TableName[Main Account] ),
        TableName[Date] < SELECTEDVALUE ( TableName[Date] )
    )
)

Regards
Zubair

Please try my custom visuals


Thanks for the swift reply!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.