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
Anonymous
Not applicable

Dax - Dynamic banding qty of customer by total value

Hi !

 

I am trying to create a table that Dynamically group summarize total by total range.

 

Sample Data table

 

DateCustomerValue
01/jana1
02/janb1
03/janc3
04/jana4
05/janc5
06/janb4
07/janc8
08/janb8
09/jana9
10/jana10
11/jand2

 

The results I am looking for is:

 

Value RangeQty CustomerTotal Value
Up to 15215
15 to 20116
Above 20124

 

I am able to do that  by creating a summarized table and add a conditional calculated column with the ranges. But I lose the possibility of dynamic change the results by date slicer.

 

I have tried to create a Dax formula to summarize and group but with no success.

 

Does anyone have any ideas?

 

Thank you very much

 

5 REPLIES 5
v-yuezhe-msft
Employee
Employee

@Anonymous,

Create the following measures in your table, create a table visual using these measures and Customer field, then check if you get expected result when using date slicer to filter your visual.

Qty  customer = DISTINCTCOUNT(Table5[Customer])

Total Value = CALCULATE(SUM(Table5[Value]))

Value Range = IF([Total Value]<=15,"up to 15",IF([Total Value]>15 && [Total Value]<=20,"15 to 20","above 20"))

If the above formulas don't help, please post the formula you use to create summarized table and expected result you want to get when using Date slicer.

Regards,

 

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you for your reply, but it did not work.

When I use the formula for the range, it only shows the range “Up 15” because it evaluates just the total of the table.

 

Value RangeCustomersValue
up to 15455

 

I can create a summarized table  using the formula: Table = SUMMARIZE('fact';'fact'[Customer];"Total";[TotalValue])

 

And then add a calculates column for the range : Range = IF([Total]<=15;"up to 15";IF([Total]>15 && [Total]<=20;"15 to 20";"above 20"))

It returns:

Customer Range Total

aabove 2024
bup to 1513
c15 to 2016
dup to 152

 

 

I have a slicer for the dates of the original "fact" table and I wish to change it and then the new table also change the values, summarizing only the values in the range of dates of the slicers. But I did not have success so far. 🙂

 

I appreciate any help.

 

 

 

 

 

 

 

 

 

 

 

 

@Anonymous,

You don't create new table. Just create the above measures I provide in your table, then create a table visual as shown in the following screenshot. And you are able to use Date slicer to filter the visual.

1.PNG2.PNG




Regards,

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yuezhe-msft

 

Thank you very much for your help. I really appreciate it.

I need a Column to count how many Customer I have per value range. So, when I remove the customer column from your example, total value and range are summarized and I have only one line, as I showed on my last post.



PowerBi.PNG

 

 

 

Do you think there is a workaround?

 

Thank you.

@Anonymous,

I am afraid that your requirement can't be achieved. Because the Total value and range are evaluated based on the Customer field, and they are dynamically filtered by Date slicer. Without Customer field, the two measures will be aggregated.

Thus, when using the Date slicer to filter the visual, it is not possible to show dynamic range, Qty number and total value without Customer as you expect.

Regards,

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.