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

Frequent Visitor

## MEASURE creation from another measure (dax)

I have the data in a format similar to below in excel powerpivot. I have a calculated measure (for stock cover days) which I need to use to calculate another measure and use it as a KPI.

 End of week Prod_hier 1 Prod_hier 2 Prod_hier 3 Market WH-Type Stock Cover (days) 2022-01-08 HIER_1A HIER_2A HIER_3AC AUS WH-B 25 2022-01-08 HIER_1A HIER_2A HIER_3AC AUS WH-A 32

KPI: min(WH-B cover days, 49)-min(WH-A days,21) - 28

Target is to achieve 0 KPI

How can I create a measure for this KPI while showing the WH-Type, their stock covers and the KPI in the pivot table?

This does not work

VAR WH-A_cov = CALCULATE( [cover days],ALL(table1[WH-Type]),table1[WH-Type] = "WH-A")
VAR WH-B_cov = CALCULATE( [cover days],ALL(table1[WH-Type]),table1[WH-Type] = "WH-B")

RETURN
MIN(WH-B_cov,49)-MIN(WH-A_cov,21)-28

4 REPLIES 4
Community Support

Hi @FAA9 ,

//KPI: min(WH-B cover days, 49)-min(WH-A days,21) - 28

//Target is to achieve 0 KPI

min(WH-B cover days, 49)-min(WH-A days,21) - 28

=min(25,49)-min(32,21)-28
=25-21-28

=-24

Did I misunderstand? If not, try this measure:

``````Measure =
VAR WH_A_cov =
CALCULATE(
[cover days],
FILTER(ALL(table1),
table1[WH-Type] = "WH-A"
&& table1[End of week] = MAX(table1[End of week])
&& table1[Prod_hier 1] = MAX(table1[Prod_hier 1])
&& table1[Prod_hier 2] = MAX(table1[Prod_hier 2])
&& table1[Prod_hier 3] = MAX(table1[Prod_hier 3])
)
)
VAR WH_B_cov =
CALCULATE(
[cover days],
FILTER(ALL(table1),
table1[WH-Type] = "WH-B"
&& table1[End of week] = MAX(table1[End of week])
&& table1[Prod_hier 1] = MAX(table1[Prod_hier 1])
&& table1[Prod_hier 2] = MAX(table1[Prod_hier 2])
&& table1[Prod_hier 3] = MAX(table1[Prod_hier 3])
)
)
VAR _result =
MIN(WH_B_cov,49)-MIN(WH_A_cov,21)-28
RETURN
_result``````

Best Regards,
Gao

Community Support Team

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Frequent Visitor

Hi,

Thanks @v-cgao-msft

Thank you for your reply. But this did not work for me. It gave me no result.

I tries another way, I put dates in the columns, and remove the date filter from the measure; it is giving me -28 only across all columns.

Community Support

Hi @FAA9 ,

Could you consider providing a sanitized sample file with the expected output?

That would be very helpful.

How to provide sample data in the Power BI Forum

Best Regards,
Gao

Community Support Team

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Frequent Visitor

I have the data in excel not pbi as I m trying to use dax in power pivot.
Its not letting me attach the excel file 😞

Announcements