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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
ljx0648
Helper III
Helper III

Sum column based on Parameter

Hi guys,

I have a datatabel like this

ljx0648_0-1715197530231.png

Custmer count = the total number of customer with the assets on the right.

 

I have also created a field paramter 

 

Parameter  =

(("Mutual Fund" , NAMEOF("measuretable"[sum_of_mutual_fund],0),

("GIC" , NAMEOF("measuretable"[sum_of_gic],1),

("Cash" , NAMEOF("measuretable"[sum_of_cash],2))

 

Thus, now I have two chart:

Sum of Total customer = 25

 

By selecting the parameter measure, i can get Mutual fund = 20, GIC = 20, Cash = 20.

 

However, I am trying to connect the dots between them.

 

I want to create a measure lets say if i select Mutual fund on the paramenter, it will have Mutual fund = 20 and total customer with Mutual fund = 1+3+3+5 = 12.

 

May I know if anyone can help?

 

Thank you!

1 ACCEPTED SOLUTION
ExcelMonke
Super User
Super User

Hello,
Taking the data you have presented at face value, you can consider the following measure:

 

 

CustomerCount = 
VAR _MF = CALCULATE(SUM('DataTable'[Customer Count]),FILTER('DataTable',NOT ISBLANK('DataTable'[Mutual Funds])))
VAR _GIC = CALCULATE(SUM('DataTable'[Customer Count]),FILTER('DataTable',NOT ISBLANK('DataTable'[GIC])))
VAR _SGD = CALCULATE(SUM('DataTable'[Customer Count]),FILTER('DataTable',NOT ISBLANK('DataTable'[CASH])))

RETURN
if(
    HASONEVALUE(Parameter[Parameter Order]),
    SWITCH(
        VALUES(Parameter[Parameter Order]),
        0, _MF,
        1, _GIC,
        2, _SGD     
    )
)

 

 

 

One note: in order to get the table to work and get the result as intended, I did have to create an additional index column so that each customer count can be attributed to a single "index". I had initial problems where it would combine similar customer counts as a single entity, if that makes sense? 

My parameter looks like this:

 

Parameter = {
    ("Mutual Funds", NAMEOF('DataTable'[Mutual Funds]), 0),
    ("GIC", NAMEOF('DataTable'[GIC]), 1),
    ("CASH", NAMEOF('DataTable'[CASH]), 2)
}

 

ExcelMonke_0-1715201746529.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
ExcelMonke
Super User
Super User

Hello,
Taking the data you have presented at face value, you can consider the following measure:

 

 

CustomerCount = 
VAR _MF = CALCULATE(SUM('DataTable'[Customer Count]),FILTER('DataTable',NOT ISBLANK('DataTable'[Mutual Funds])))
VAR _GIC = CALCULATE(SUM('DataTable'[Customer Count]),FILTER('DataTable',NOT ISBLANK('DataTable'[GIC])))
VAR _SGD = CALCULATE(SUM('DataTable'[Customer Count]),FILTER('DataTable',NOT ISBLANK('DataTable'[CASH])))

RETURN
if(
    HASONEVALUE(Parameter[Parameter Order]),
    SWITCH(
        VALUES(Parameter[Parameter Order]),
        0, _MF,
        1, _GIC,
        2, _SGD     
    )
)

 

 

 

One note: in order to get the table to work and get the result as intended, I did have to create an additional index column so that each customer count can be attributed to a single "index". I had initial problems where it would combine similar customer counts as a single entity, if that makes sense? 

My parameter looks like this:

 

Parameter = {
    ("Mutual Funds", NAMEOF('DataTable'[Mutual Funds]), 0),
    ("GIC", NAMEOF('DataTable'[GIC]), 1),
    ("CASH", NAMEOF('DataTable'[CASH]), 2)
}

 

ExcelMonke_0-1715201746529.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





A follow up question here my friend,

 

This Measure works perfectly if I pick one Parameter. 

 

However, May I know if you can show me a trick how does it work with two or even three parameters?

 

For example, 

Mutual fund = 12 customer

GIC = 11 customer

Cash = 12 Customer.

 

Now I want to see how many customer I have with both GIC and Cash, so I multi-select both.

 

The total is 40 and customer count is 3+3 = 6 (because only these 2 groups of customer have GIC and Cash at the same time).

 

Please let me know if you have any idea.

 

Thank you!

Works like a charm! Much appreciated 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors