- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

# Need help with the measure

[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-05-2018 08:30 AM - edited 12-05-2018 09:41 AM

Hello,

I have a table as shown below;

Rows = Report Parameters

Columns = Header_1, Header_2

Values= Value

I am trying to calculate the values based on the following logic;

**If Header_2 = "Curr.to OEC" then value = (Curr.mth - Upd.OEC), else Value = Value **

I have created the following measure but it is not working, what I am doing wrong here

New_Value = if(SELECTEDVALUE(POC[report_param] = "Curr.to OEC"), (CALCULATE(sum(Summary[Value Num]), FILTER(Summary, Summary[Header_2] = "Curr.mth.")) - CALCULATE(sum(Summary[Value Num]), FILTER(Summary, Summary[Header_2] = "Upd.OEC"))), Sum(Summary[Value Num]))

Solved! Go to Solution.

Accepted Solutions

## Re: Need help with the measure

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-06-2018 12:51 PM

This was a good one

Let's see how this shakes out:

- Created a Values Measure because do not like using implied measures

Value Measure = SUM ( POC[Value] )

Here's the code that will reference that measure:

Curr to OEC MATH =

if( VALUES(POC[Header_2]) = "Curr.to OEC",

CALCULATE(

[Value Measure],

FILTER(

ALL( POC),

POC[Header_2]="Curr.mth."),

VALUES( POC[report_param]),

VALUES( POC[project_number])

)

-CALCULATE(

[Value Measure],

FILTER(

ALL( POC),

POC[Header_2]="Upd.OEC"),

VALUES( POC[report_param]),

VALUES( POC[project_number])

),

[Value Measure]

)

Using Values as a fitler for calculate restores the initial filter context, so that's what we want.

All Replies

## Re: Need help with the measure

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-05-2018 09:38 PM

Hi @Bhaveshp,

Based on your information, it seems that you have two tables.

If it is convenient, could you share your data sample which could reproduce your scenario and your dessired outpu so that we could help further on it?

Best Regards,

Cherry

If this post

**helps**, then please consider

**to help the other members find it more quickly.**

*Accept it as the solution*## Re: Need help with the measure

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-06-2018 05:45 AM

Hi @v-piga-msft, I have only one table which I'm trying to create a measure for the Value. Please reference the Sample pbix file in the link below.

https://drive.google.com/file/d/1cPbZvuu7R_IdfVqoW9xR6SSIT2EmZW42/view?usp=sharing

## Re: Need help with the measure

[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-06-2018 05:54 AM - edited 12-06-2018 05:54 AM

@v-piga-msft I have created a measure (New_Value);

*New_Value =*

*VAR Curr_Mo =*

*CALCULATE ( SUM ( POC[Value] ), (POC[Header_2]) = "Curr.mth." )*

*VAR Upd_OEC =*

*CALCULATE ( SUM ( POC[Value] ), (POC[Header_2]) = "Upd.OEC" )*

*RETURN*

*IF (*

*Min(POC[Header_2]) = "Curr.to OEC",*

*Curr_Mo - Upd_OEC,*

*SUM ( POC[Value] )*

*)*

*If Header_2 = "Curr.to OEC" then value = (Curr.mth - Upd.OEC), else Value = Value*

## Re: Need help with the measure

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-06-2018 10:58 AM

Can anyone help me with this ?

## Re: Need help with the measure

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-06-2018 12:51 PM

This was a good one

Let's see how this shakes out:

- Created a Values Measure because do not like using implied measures

Value Measure = SUM ( POC[Value] )

Here's the code that will reference that measure:

Curr to OEC MATH =

if( VALUES(POC[Header_2]) = "Curr.to OEC",

CALCULATE(

[Value Measure],

FILTER(

ALL( POC),

POC[Header_2]="Curr.mth."),

VALUES( POC[report_param]),

VALUES( POC[project_number])

)

-CALCULATE(

[Value Measure],

FILTER(

ALL( POC),

POC[Header_2]="Upd.OEC"),

VALUES( POC[report_param]),

VALUES( POC[project_number])

),

[Value Measure]

)

Using Values as a fitler for calculate restores the initial filter context, so that's what we want.

## Re: Need help with the measure

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-07-2018 06:00 AM

Wow, Awesome, thank you @Nick_M for your solution . This is exactly what I'm looking for, It worked like a charm.