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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
EndriuBlack
Frequent Visitor

Measure doesn't show what it should

Hello,

maybe someone could help with my problem.

 

I have a simple measure SUM with a FILTER but it doesn't aplly a filter as it should

 

here is my case:

 

My model is a simple two table model: Calendar and fact table

 

I don't understand why this calculation doesn't work:

 

Pierwsze zlecenie =
CALCULATE( [Sprzedaż Suma],
FILTER( Emisje, Emisje[ID zlecenia na reklamę] = [ID Pierwszego zlecenia] )
)

 

where 

 

measure below is a simple SUM of prizes

Sprzedaż Suma =
SUM( Emisje[Cena netto PLN] )

 

and I need CALCULATE to give answer about a prize (Sprzedaż Suma) for a specific order number.

FILTER( Emisje, Emisje[ID zlecenia na reklamę] = [ID Pierwszego zlecenia] )
The number of a specific ORDER is calculated in a measure: [ID Pierwszego zlecenia]) and Emisje[ID zlecenia na reklamę] is a column of order numbers.
 
[ID pierwszego zlecenia] is calculated like this:

ID Pierwszego zlecenia =

CALCULATE( _Miary[ID zlec],
FILTER( Kalendarz, 'Kalendarz'[Date] = _Miary[MIN Data Selected Rok])
)

and it gives the order number that I want

 

My table looks like this:

EndriuBlack_0-1679312877564.png

Order number is calculated well (ID pierwszego zlecenia), but the SUM of prizes for "Pierwsze zlecenie" shows me a sum of all revenue from a client in whole year (firs column is a name of client). I really don't know why FILTER function doesn'y apply only calculated order number "ID pierwszego zlecenia" to a measure.

 

Any idea what may be a problem? Cause I really don't know, this is very easy DAX this time. Order ID is calculated, and I just need a SUM of prizes of it...

 

I wolud be very gratefull if someone helps me 🙂

 

Best Regards

Andrew

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Pierwsze zlecenie =
VAR OrderID = [ID Pierwszego zlecenia]
RETURN
    CALCULATE (
        [Sprzedaż Suma],
        FILTER ( Emisje, Emisje[ID zlecenia na reklamę] = OrderID )
    )

View solution in original post

2 REPLIES 2
EndriuBlack
Frequent Visitor

Thank You! It works as it should 🙂

 

Best Regards

Andrew

johnt75
Super User
Super User

Try

Pierwsze zlecenie =
VAR OrderID = [ID Pierwszego zlecenia]
RETURN
    CALCULATE (
        [Sprzedaż Suma],
        FILTER ( Emisje, Emisje[ID zlecenia na reklamę] = OrderID )
    )

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.