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

What formula to use

Dear All,

I have two tables below and i want to split my price into 4 new columns:

1. v low price

2. low price

3. Avg price

4. High price

 

The price to be shown in each of these columns should be:
o Very Low:  if price < (average - $7.50) for that product, show the quantity, if not show "0"
o Low:  if price between (average - $7.50) and (average - $2.50) for that product, show the quantity, if not show "0"
o Average:  If price between (average - $2.50) and (average + $2.50), show the quantity, if not show "0"
o High: If price > (average + $2.50), show the quantity, if not show "0"

 

How do i calculate this? Please advise. 

 

Yau0101_0-1630718404809.png

 

 

2 ACCEPTED SOLUTIONS
VahidDM
Super User
Super User

Hi @Yau0101 

 

Please donwload this file, I added all those columns to your table.

Download Link : https://gofile.io/d/L3yBiZ

 

Output:

VahidDM_0-1630740947200.png

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Appreciate your Kudos ✌️!!

View solution in original post

Hi @Yau0101 

 

I did not get your question very well.

Do you want to have separate tables for Price and Quantity? then use 

Or do you want duplicate columns to indicate exact figures from Price and Quantity? if yes try these codes to add new columns:

Price 1 = 'Table'[price]
Volume = 'Table'[quantity]
 
If you need something else, share more details.

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos !!

 

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

Hi @Yau0101 

 

Please donwload this file, I added all those columns to your table.

Download Link : https://gofile.io/d/L3yBiZ

 

Output:

VahidDM_0-1630740947200.png

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Appreciate your Kudos ✌️!!

Hi @VahidDM 

 

Thank you for the soultion. I have another question, i want to create new measure name "Price 1" and "volume". The "Price 1", i want to it to grab all the data from price column and the "volume" measure i want to grab data from quantity column. what formula should i use? Please advise. 

Hi @Yau0101 

 

I did not get your question very well.

Do you want to have separate tables for Price and Quantity? then use 

Or do you want duplicate columns to indicate exact figures from Price and Quantity? if yes try these codes to add new columns:

Price 1 = 'Table'[price]
Volume = 'Table'[quantity]
 
If you need something else, share more details.

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos !!

 
Greg_Deckler
Super User
Super User

@Yau0101 I think the first thing you need is a working average measure like:

Average Measure =
  VAR __Product = MAX('Table'[Product])
RETURN
  AVERAGEX(FILTER(ALL('Table'),[Product] = __Product),[price])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors