Forum Discussion
dynamic grouping question.
- Anonymous8 years ago
Hmmm, I may misunderstanding your case since I don't know your data structure. My suggestion is provided based on the following scenario.
There is a Product -> sales table like this. One product could have several sales value.
Then created a new table using the following Dax
Total Sales = GROUPBY('Product','Product'[Product],"Total Sales",SUMX(CURRENTGROUP(),'Product'[Sales]))And then, created a new column to tag the product based on the total sales number
Sales Range = IF([Total Sales]<30000, "Low Sales", "High Sales")
After that, you could create a chart to show the High/Low Sales products.
How can I add a column with the IF condition you have mentioned Jessica?
Base table has only 2 columns Products and Sales with 1:many relationship. The Total Sales is achieved via a measure with the below formula.
TotalSaleMeasure = calculate(sum(sales), groupby(source, source[product]))
This measure gives me the Product and Total Sales in a tabular format. Further, I was able to add the High/Low sale to it depending on the Total Sale amount using another measure.
Hmmm, I may misunderstanding your case since I don't know your data structure. My suggestion is provided based on the following scenario.
There is a Product -> sales table like this. One product could have several sales value.
Then created a new table using the following Dax
Total Sales = GROUPBY('Product','Product'[Product],"Total Sales",SUMX(CURRENTGROUP(),'Product'[Sales]))And then, created a new column to tag the product based on the total sales number
Sales Range = IF([Total Sales]<30000, "Low Sales", "High Sales")
After that, you could create a chart to show the High/Low Sales products.
- ppgandhi118 years agoHelper V
Perfect! This is what I was looking for! Thanks bunches Jessica. Learnt about CurrentGroup() today. didn't know how to use that. :)
- v-chuncz-msft8 years agoCommunity Support
Glad to hear that. You may help accept solution. Your contribution is highly appreciated.
- Anonymous3 years agoNot applicable
Can this be achieved as a column in the original table? is there a way to achieve the grouping and bucketing in a single step?