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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
joluwa
Helper I
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 

joluwa_0-1696422090180.png

 

1 ACCEPTED SOLUTION
Sandhya1234
Helper II
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 ) )

View solution in original post

8 REPLIES 8
Sandhya1234
Helper II
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 ) )

Sandhya1234
Helper II
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 ) )

Idrissshatila
Super User
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
    )
 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin
Vote for my Community Mobile App Idea 💡



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




that returns 0.55 for both online and in store 

joluwa_0-1696429933216.png

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

joluwa
Helper I
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:

joluwa_0-1696422912244.png

 

Hello @joluwa ,

 

Can you show me your measure?

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin
Vote for my Community Mobile App Idea 💡



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




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 :
TypeROS #£ Web
IN STORE0
ONLINE0.55
Idrissshatila
Super User
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)

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin
Vote for my Community Mobile App Idea 💡



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Helpful resources

Announcements
Europe Fabric Conference

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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