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! Learn more

Reply
Anonymous
Not applicable

calculating difference based on multiple filters

Ok resorting to posting on here for help. I am trying to find the difference between how many orders have left a state and how many have came into a state. Below is how my data is set up:

destination state            date delivered                   date shipped           order id             shipper state          orders

TX                                  1/1/2019                             1/1/2019                 12315                  IL                           1

AL                                  1/1/2019                             1/1/2019                 12642                   NY                       1

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

You can try to use following measure formula to calculate leave and arrive count based current date and state:

leave count =
VAR currDate =
    MAX ( calendar[Date] )
RETURN
    CALCULATE (
        COUNT ( Table[ID] ),
        FILTER (
            ALLSELECTED ( Table ),
            currDate IN CALENDAR ( Table[Date delivered], Table[date shipped] )
                && [Date delivered] <> currDate
                && [date shipped] <> currDate
        ),
        VALUES ( Table[shipper state] )
    )


arrived count =
VAR currDate =
    MAX ( calendar[Date] )
RETURN
    CALCULATE (
        COUNT ( Table[ID] ),
        FILTER ( ALLSELECTED ( Table ), [date shipped] = currDate ),
        VALUES ( Table[destination state] )
    )

If above not help, can you please explain more about your requirement?

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

No this didn't help. My ultimate goal is to take the variance of two visuals. One visual has all the shipments leaving a state and the other has all the shipments coming into a state. I need a 3rd visual that takes the difference of these.
Anonymous
Not applicable

Hi @Anonymous ,

You can write a measure with variable summarize table(state, leave count, coming count), then use iteration function VARX.P/VARX.S on summary table to calculate variance.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.