cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## Measure to only be applied for a specific row

I have written a measure and of course by default the measure will calculate based on the row context. Is there any way to basically make the measure only calculate for a specific row and then return 0 for the row which it does not correlate to?

For example the measure ROS #£M Web should only be calculated for ONLINE branches but because it is doing a row by row calculation it will do the same for 'IN STORE' when I actually need the 'IN STORE' to return 0

1 ACCEPTED SOLUTION
Helper II

@joluwa Try this .
ROS # £M Web = IF ( SELECTEDVALUE('Campaign Overview'[Type]) = "IN STORE", 0, ROUND ( DIVIDE ( SUM('Campaign Overview'[orders]), SUM('Campaign Overview'[salesPerMillion]) ), 2 ) )

8 REPLIES 8
Helper II

@joluwa Try this .
ROS # £M Web = IF ( SELECTEDVALUE('Campaign Overview'[Type]) = "IN STORE", 0, ROUND ( DIVIDE ( SUM('Campaign Overview'[orders]), SUM('Campaign Overview'[salesPerMillion]) ), 2 ) )

Helper II

@joluwa Try this .
ROS # £M Web = IF ( SELECTEDVALUE('Campaign Overview'[Type]) = "IN STORE", 0, ROUND ( DIVIDE ( SUM('Campaign Overview'[orders]), SUM('Campaign Overview'[salesPerMillion]) ), 2 ) )

Super User

HEllo @joluwa ,

try this

ROS # £M Web =
ROUND(
DIVIDE (
calculate(SUM('Campaign Overview'[orders]), branch_type = "ONLINE"),
Calculate(SUM('Campaign Overview'[salesPerMillion]), branch_type = "ONLINE"),
0
)
,2
)

 Vote for my Community Mobile App Idea

Proud to be a Super User!

Helper I

that returns 0.55 for both online and in store

because the code will apply the same for the instore reason why it cant be added within the code because the row context will still override it

Helper I

Thanks for the response, that is similar to what I tried but when that happens it just repeats the same value for both like so:

Super User

Hello @joluwa ,

Can you show me your measure?

 Vote for my Community Mobile App Idea

Proud to be a Super User!

Helper I
ROS # £M Web =
ROUND(
DIVIDE (
SUM('Campaign Overview'[orders]),
SUM('Campaign Overview'[salesPerMillion])
)
,2
)

This is the measure but I need it to return 0 for the row of 'IN STORE' but I cannot explicitly do that within the measure because it will just repeat the same value for both.

So the output i'm looking for is :
 Type ROS #£ Web IN STORE 0 ONLINE 0.55
Super User

Hello @joluwa ,

yes sure try this

New measure =
var ONLINE = calculate ( "Add here the ROS #£M Web calculation " , branch_type = "ONLINE")
return

if ( ONLINE = blank(), 0, ONLINE)

 Vote for my Community Mobile App Idea

Proud to be a Super User!

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors