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

View all the Fabric Data Days sessions on demand. View schedule

Reply
mshaikh
Regular Visitor

MS - Conditional Total

Hi

 

I am looking for conditional sales total formula using following condition. Please find attached document for reference.

 

Complete_Date <= filter date  Filter date is between 2018-03-25 and 2018-03-31

Complete Percent = 100

Salesrep between SP1 and SP2

Code = Sales

 

Expected result = 2800

 

Can someone please provide suitable formula which work even after changing filter.

 

Thanks in advance,

 

MS

Sample.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @mshaikh,

 

When you use ALLSELECTED function in filter who already used ALL function, it will ignore filter effect which allselected provide.

For this scenario, please use VAR function to define selected value list outside of filter which used ALL function.

Measure =
VAR _SPerson =
    ALLSELECTED ( Table[Sales Person] )
VAR _SCode =
    ALLSELECTED ( Table[Code] )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER (
            ALL ( Table ),
            [Contract_Complete Date] <= MIN ( Calendar[Date] )
                && [Complete_Percent] = 100
                && [Sales Person] IN _SPerson
                && [Code] IN _SCode
        )
    )

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT

 

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

HI @mshaikh,

 

You can try to use below measure if it works for your requirement:

Measure =
CALCULATE (
    SUM ( Table[Amount] ),
    FILTER (
        ALLSELECTED ( Table ),
        [Contract_Complete Date] <= MIN ( Calendar[Date] )
            && [Complete_Percent] = 100
            && [Sales Person] IN ALLSELECTED ( Table[Sales Person] )
            && [Code] IN ALLSELECTED ( Table[Code] )
    )
)

 

If above not help, please share some sample data for test.

 

Regards,

Xiaoxin Sheng

Hi

 

Thanks for the formula.  Salesperson IN ALLSELECTED is not working with slicer. However when we manully add Salesperson code in measure it works. Please have a look at attached result set for reference.

 

 

Hi

 

Thanks for the formula.  Salesperson IN ALLSELECTED is not working with slicer. However when we manully add Salesperson code in measure it works. Please have a look at attached result set for reference.                Thanks,  MS

 

Sample1.png

 

 

 

Anonymous
Not applicable

HI @mshaikh,

 

When you use ALLSELECTED function in filter who already used ALL function, it will ignore filter effect which allselected provide.

For this scenario, please use VAR function to define selected value list outside of filter which used ALL function.

Measure =
VAR _SPerson =
    ALLSELECTED ( Table[Sales Person] )
VAR _SCode =
    ALLSELECTED ( Table[Code] )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER (
            ALL ( Table ),
            [Contract_Complete Date] <= MIN ( Calendar[Date] )
                && [Complete_Percent] = 100
                && [Sales Person] IN _SPerson
                && [Code] IN _SCode
        )
    )

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT

 

Regards,

Xiaoxin Sheng

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