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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ljx0648
Helper II
Helper II

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
Responsive Resident
Responsive Resident

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

 

 

View solution in original post

3 REPLIES 3
ExcelMonke
Responsive Resident
Responsive Resident

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

 

 

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.