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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sdhn
Responsive Resident
Responsive Resident

Logic to restrict max number

Hi there,

 

I am rewriting my message with current status.

 

I have a working messure as below:

 

Working % =
VAR _Ratio =
DIVIDE (
SUM ( 'Table'[Col 1] ) + SUM ( 'Table'[Col 2] ),
SUM ( 'Table'[Col 3] )
)
RETURN
MIN ( _Ratio, 1 )
 
 Outcome:
Any product percentage over 100 % or  equal to 100 % will display s as 100 %.  No changes in the lower numbers. such as 67 % would be 67 %.
 
sdhn_1-1645120326451.png

 

 
Now I need to write code base on 2 columns (Col 2, Col 3 from above)  from the same table above. Need to write similar logic.
Instead of third column I used number "1". 
 

 

Not Working  % =
VAR _Ratio =
DIVIDE (
SUM ( 'Table'[Col. 2 ) + SUM ( 'Table'[Col 3] ), (1)
)
RETURN
MIN ( _Ratio, 1 )

 

OUTCOME

All values of product are dispalying as 100%.

 

sdhn_0-1645120289215.png   Help will be appreciated. 
7 REPLIES 7
Icey
Community Support
Community Support

Hi @sdhn ,

 

I have the same doubt as @AlexisOlson : Why do you divide by 1 in the "Not Working" measure?



Not Working  % =
VAR _Ratio =
DIVIDE (
SUM ( 'Table'[Col. 2 ) + SUM ( 'Table'[Col 3] ), (1)
)
RETURN
MIN ( _Ratio, 1 )

 


What do the two columns represent? What is your calculation logic?

 

 

Best Regards,

Icey

sdhn
Responsive Resident
Responsive Resident

without DIVIDE option

 

Not Working  % =
VAR _Ratio =
(
SUM ( 'Table'[Col. 2 ) + SUM ( 'Table'[Col 3] ), (1)
)
RETURN
MIN ( _Ratio, 1 )

  

OUTCOME
ALL Products is displaying as 100 %

sdhn
Responsive Resident
Responsive Resident

without RATIO, 

 

Not Working  % =  SUM ( 'Table'[Col. 2 ) + SUM ( 'Table'[Col 3] ), (1)

 

 

OUTCOME:

getting very large values

 

sdhn_0-1645140531413.png

 

sdhn
Responsive Resident
Responsive Resident

Below

AlexisOlson
Super User
Super User

I don't follow what the ratio is intended to be in the second example. Why are you dividing by 1?

sdhn
Responsive Resident
Responsive Resident

I do not have an answer.  Just trying to copy working code. (First one)

 

Any product over 100 % must shows as 100 %. Also 100 must display as 100 too.  

Rest same as they are.   Thanks

It's not easy to answer a question based on what you don't want. What result do you want?

 

Why are the results you're getting not correct? How do you know they're not correct if you don't know what they should be? What do you expect to get if things work properly?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.