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 II

## Modified code not working

Hi all,

I have following code, it works at the moment.

DoDoverboundaryN =

IF (
ISINSCOPE(TRACKSHEET[IoT_ID_NUMBER]),

CALCULATE (
IF ( VALUES(TRACKSHEET[Capacitythreshold])> ABS ([Max DoD] ), 0, [Max DoD] ),
ALL ( DimDate[Date] )
)
)

Instead returned measure: [Max DoD] in if clause, I would like to change it to a formula:
[Max DoD]/VALUES(TRACKSHEET[Capacitythreshold]

the reuslt will be a measure divide by a column in a table, it sounds weird, however if we put it to a visual table with IoT_ID_NUMBER as first column, then calculation [Max DoD]/VALUES(TRACKSHEET[Capacitythreshold] is only one number
I modified the code as following, the red color is the place modified.
DoDoverboundaryN =

IF (
ISINSCOPE(TRACKSHEET[IoT_ID_NUMBER]),

CALCULATE (
IF ( VALUES(TRACKSHEET[Capacitythreshold])> ABS ([Max DoD] ), 0[Max DoD]/VALUES(TRACKSHEET[Capacitythreshold] ),
ALL ( DimDate[Date] )
)

the measure wont work anymore, can someone help me in this case?

1 ACCEPTED SOLUTION
Super User

@reynold522
Before I start asking you questions, I would like you first try:

``````DoDoverboundaryN =
IF (
ISINSCOPE ( TRACKSHEET[IoT_ID_NUMBER] ),
CALCULATE (
VAR MaxDoD = [Max DoD]
VAR Capacitythreshold =
SUM ( TRACKSHEET[Capacitythreshold] )
RETURN
IF (
Capacitythreshold > ABS ( [Max DoD] ),
0,
DIVIDE ( MaxDoD, Capacitythreshold )
),
ALL ( DimDate[Date] )
)
)``````

5 REPLIES 5
Helper II

Super User

try to use DIVIDE function instead of the / operator

Helper II

Thank you I tried this and wrote it in top of my code. it was not working due to measure divide column,

is it possible to share your suggested code?

Super User

@reynold522
Before I start asking you questions, I would like you first try:

``````DoDoverboundaryN =
IF (
ISINSCOPE ( TRACKSHEET[IoT_ID_NUMBER] ),
CALCULATE (
VAR MaxDoD = [Max DoD]
VAR Capacitythreshold =
SUM ( TRACKSHEET[Capacitythreshold] )
RETURN
IF (
Capacitythreshold > ABS ( [Max DoD] ),
0,
DIVIDE ( MaxDoD, Capacitythreshold )
),
ALL ( DimDate[Date] )
)
)``````

Helper II

thank you a lot. It works

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.

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors