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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
ACN_Teo_Garro
New Member

Measure with 2 table involved

We have 2 table:

1) CRUSCOTTO: NAME, PRELIEVI_MULTI, RUOLO_MASTER

2) REGOLE_OMOG: RUOLO_MASTER, SOGLIA

We must create a new measure that create a sum but with some filter joined between the 2 table above (as the following sql extraction):

 

SELECT sum(A.PRELIEVI_MULTI)

from CRUSCOTTO A

inner join REGOLE_OMOG B on (A.RUOLO_MASTER=B.RUOLO_MASTER)

where A.PRELIEVI_MULTI >= B.SOGLIE

 

We try to do this but it doesn't work:

 

test sum prel omog = CALCULATE(SUMX(CRUSCOTTO,CRUSCOTTO[PRELIEVI_MULTI]),FILTER(CRUSCOTTO,CRUSCOTTO[RUOLO_MASTER]=SELECTEDVALUE(REGOLE_OMOG[RUOLO_MASTER]) && CRUSCOTTO[PRELIEVI_MULTI]>=SELECTEDVALUE(REGOLE_OMOG[A_N])))

 

Can someone help us?

Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ACN_Teo_Garro 

You can try the following Measure.

test sum prel omog =
VAR a =
    CALCULATE (
        MAX ( REGOLE_OMOG[SOGLIA] ),
        FILTER (
            REGOLE_OMOG,
            [RUOLO_MASTER] = SELECTEDVALUE ( REGOLE_OMOG[RUOLO_MASTER] )
        )
    )
RETURN
    CALCULATE (
        SUM ( CRUSCOTTO[PRELIEVI_MULTI] ),
        FILTER (
            CRUSCOTTO,
            [RUOLO_MASTER]
                IN VALUES ( REGOLE_OMOG[RUOLO_MASTER] )
                    && [ PRELIEVI_MULTI] >= a
        )
    )

And can you provide some sample data?

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @ACN_Teo_Garro 

You can try the following Measure.

test sum prel omog =
VAR a =
    CALCULATE (
        MAX ( REGOLE_OMOG[SOGLIA] ),
        FILTER (
            REGOLE_OMOG,
            [RUOLO_MASTER] = SELECTEDVALUE ( REGOLE_OMOG[RUOLO_MASTER] )
        )
    )
RETURN
    CALCULATE (
        SUM ( CRUSCOTTO[PRELIEVI_MULTI] ),
        FILTER (
            CRUSCOTTO,
            [RUOLO_MASTER]
                IN VALUES ( REGOLE_OMOG[RUOLO_MASTER] )
                    && [ PRELIEVI_MULTI] >= a
        )
    )

And can you provide some sample data?

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi Yolo Zhu,

thanks for your feedback.

 

The Measure that you provide us works fine and apply the filter that we need.

But, as you can see in the picture below

ACN_Teo_Garro_0-1685085702122.png

we have

- in the left side (test GREG) the measure with your filter applied

- in the right side (RI_AR11_PREL_ANOM)  the measure without filter

the data in the column are correct (i.e. in the first row is correct that without filter the value is 3196 and with filters applied become 2177) BUT the sum value at the and of the column in INCORRECT for the filtered column (test GREG). It doesn't take the filter in it.

 

Could you explain why?

Can someone help us?

 

Regards

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.