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
Matthew_BR
Frequent Visitor

Round a Number Based on a Columm

Hi, I have a spreadsheet with the names of the items, the package sizes and the demand for the item in the month. Each product can have different types of packaging.

 

I'm trying to create a column that looks at demand and approximates it to one of the package's capacity. Could you help me please?

 

Sorry if it gets a little abstract or weird, but I'm working on a bigger project but it's just that part that I don't know how to do. 

 

Thanks to anyone who will look into this!

 

ItemPackageDemandWhat I need the table to do
AAA102220
AAA20810
AAA303840
AAA402730
1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this

Column = 
 VAR t1 = [Demand]
 VAR m1 = MAXX(FILTER(ALL('Table'),'Table'[Package]<=t1),[Package])
 VAR m2 = MINX(FILTER(ALL('Table'),'Table'[Package]>=t1),[Package])
 VAR _Results = t1-m1 < m2-t1
 RETURN 
 IF(_Results,m1,m2)

Screenshot_1.png

View solution in original post

3 REPLIES 3
Ahmedx
Super User
Super User

pls try this

Column = 
 VAR t1 = [Demand]
 VAR m1 = MAXX(FILTER(ALL('Table'),'Table'[Package]<=t1),[Package])
 VAR m2 = MINX(FILTER(ALL('Table'),'Table'[Package]>=t1),[Package])
 VAR _Results = t1-m1 < m2-t1
 RETURN 
 IF(_Results,m1,m2)

Screenshot_1.png

Thank you so much! It worked

Legend_11
Helper III
Helper III

You can create one new column using demand column using following dax

 

Column = ROUND('Table'[demand],-1)
 
Legend_11_0-1690252925249.png

 

 
Hope this helps!
 

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.