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

Need support with Calculated measures

Hello,

I have a problem that I need help with as I’m unable to find a solution myself.

 

I currently have a table visualization set up as bellow where I’m summarizing data from multiple query’s.

 

What I want is to have a Calculated measure that will show the Stock zone for Location "ZZ" / "OO" / "YY" / "XX" for each distinct order line number on each Delivery number.

Transaction Date

Order number

Delivery number

Order line number

Stock Zone

Location

Stock Zone_2

(TryingToAdd)

2021-03-19

3000000015

1000000023

5

E

EE

Z

2021-03-18

3000000015

1000000023

5

D

DD

Z

2021-03-17

3000000015

1000000023

5

Z

ZZ

Z

2021-03-16

3000000015

1000000023

5

B

BB

Z

2021-03-15

3000000015

1000000023

5

A

AA

Z

2021-03-11

3000000015

1000000023

7

E

EE

O

2021-03-10

3000000015

1000000023

7

D

DD

O

2021-03-09

3000000015

1000000023

7

O

OO

O

2021-03-08

3000000015

1000000023

7

B

BB

O

2021-03-07

3000000015

1000000023

7

A

AA

O

2021-02-24

3000000006

1000000019

1

E

EE

Y

2021-02-23

3000000006

1000000019

1

D

DD

Y

2021-02-22

3000000006

1000000019

1

Y

YY

Y

2021-02-21

3000000006

1000000019

1

B

BB

Y

2021-02-20

3000000006

1000000019

1

A

AA

Y

2021-01-09

3000000001

1000000003

2

E

EE

X

2021-01-08

3000000001

1000000003

2

D

DD

X

2021-01-07

3000000001

1000000003

2

X

XX

X

2021-01-06

3000000001

1000000003

2

B

BB

X

2021-01-05

3000000001

1000000003

2

A

AA

X

 

I will later on filter the table to only have distinct rows for delivery number/Order line number where I will keep the oldest date ones. 

Transaction Date

Order number

Delivery number

Order line number

Stock Zone

Location

Stock Zone_2

(TryingToAdd)

2021-03-19

3000000015

1000000023

5

E

EE

Z

2021-03-11

3000000015

1000000023

7

E

EE

O

2021-02-24

3000000006

1000000019

1

E

EE

Y

2021-01-09

3000000001

1000000003

2

E

EE

X

 

Is this something that's solvable using Calculated measures?

I’m unable to use calculated columns unfortunate.

 

Hope i have been cleared enough with what im trying to have solved here.

 

Thanks in advance,

Marcus L

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @MaQaN ,

 

Use the measure below:

 

Measure = CALCULATE(MAX('Table'[Stock Zone]),FILTER(ALL('Table'),'Table'[Order line number] = MAX('Table'[Order line number])&&'Table'[Location] IN{ "ZZ", "OO", "YY" ,"XX"}))

 

Capture20.PNG

 

For more details, please refer to the pbix file.

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hi @MaQaN ,

 

Use the measure below:

 

Measure = CALCULATE(MAX('Table'[Stock Zone]),FILTER(ALL('Table'),'Table'[Order line number] = MAX('Table'[Order line number])&&'Table'[Location] IN{ "ZZ", "OO", "YY" ,"XX"}))

 

Capture20.PNG

 

For more details, please refer to the pbix file.

 

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

 

Best Regards,

Dedmon Dai

m3tr01d
Continued Contributor
Continued Contributor

Hi @MaQaN 

can you clarify for Line number 5 why is the last column is showing Z?
What is the rule to compute the last column?

MaQaN
Frequent Visitor

Hello @m3tr01d,

A new order line number is generated for each distinkt part on the same Delivery number. So the delivery number 1000000023 from the table consist of atleast 5 difrent parts.

Example:

Deliver number 1000000023

Line 1 = Phone

Line 2 = Computer

Line 3 = Headset

...

All these parts will then go on and be delivered to customer that placed the Order number for specified delivery number.

 

"What is the rule to compute the last column?"

As for the last column showing Z is what im trying to accomplise. It's should show me the specifik Stock Zone that im intrested in on each order line and where it previus have been to.

 

In my mind im thinking something like:

IF Stock Zone is "AA" then "Z" en return "Z" as long as Delivery number & Order line number is the same.

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.