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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
frknklcsln
Helper II
Helper II

how to get multiple outputs from a measure?

Hi,

 

I have a measure calculating for 4 different categories look like the below:

 

var _a = CALCULATE(....)
var _b = CALCULATE(...)

var sum_a = CALCULATE(...)
var sum_b = CALCULATE(...)

What I want to get is that when the category is a show calculation of a, b c, and d.

 

categorycalculation
aa/sum of a
bb / sum of b

...

 

But I cannot write the part after the return function.

 

Should like like this i believe:

return

if category is a:

then DIVIDE(_a, sum_a),

if category is b:

then divide (_b, sum_b)

 

I used ISFILTERED(Category) it works, but when I want to filter it with a date using a slicer, the filter is not applying.

 

I cant add the date filter after the return function because dates are not certain and I want to leave it to the user to choose it with a slicer. 

 

How can I get the multiple outputs without using the ISFILTERED function because it disables the date slicer?

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @frknklcsln ,

Please have a try.

performance measure=
var _a = calculate(...)
var _b = calculate(...)
var _c = calculate(...)
var _d= calculate(...)
var sum_a = calculate(...)
var sum_b = calculate(...)
var sum_c = calculate(...)
var sum_d= calculate(...)

return
if (max('table'[category])="a",divide(_a,sum_a),if (max('table'[category])="b",divide (_b,sum_b),if (max('table'[category])="c",divide (_c,sum_c),if (max('table'[category])="d",divide (_d,sum_d),blank()))))

 

If I have misunderstood your meaning, please provide your pbix file without privacy information and more details with your desired output.

 

Best Regards
Community Support Team _ Polly

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@frknklcsln , Try like

New Measure = Switch ( True() ,

max(Table[Category1])  ="Category1" , [Measure1],

max(Table[Category2])  ="Category1" , [Measure2],

max(Table[Category3])  ="Category1" , [Measure3],

max(Table[Category4])  ="Category1" , [Measure4] )

 

 

or

New Measure = sumx(values(Table[Category1] ) , Switch ( True() ,

max(Table[Category1])  ="Category1" , [Measure1],

max(Table[Category2])  ="Category1" , [Measure2],

max(Table[Category3])  ="Category1" , [Measure3],

max(Table[Category4])  ="Category1" , [Measure4] ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Sir, I need to write after the return function. I have only 1 measure which calculates for 4 different categories.

performance measure=
var _a = calculate(...)
var _b = calculate(...)
var _c = calculate(...)
var _d= calculate(...)

var sum_a = calculate(...)
var sum_b = calculate(...)
var sum_c = calculate(...)
var sum_d= calculate(...)

// I need below part
return
if category a:


divide(_a,sum_a)

if category b:

divide (_b,sum_b)

??
..

??

 

Anonymous
Not applicable

Hi @frknklcsln ,

Please have a try.

performance measure=
var _a = calculate(...)
var _b = calculate(...)
var _c = calculate(...)
var _d= calculate(...)
var sum_a = calculate(...)
var sum_b = calculate(...)
var sum_c = calculate(...)
var sum_d= calculate(...)

return
if (max('table'[category])="a",divide(_a,sum_a),if (max('table'[category])="b",divide (_b,sum_b),if (max('table'[category])="c",divide (_c,sum_c),if (max('table'[category])="d",divide (_d,sum_d),blank()))))

 

If I have misunderstood your meaning, please provide your pbix file without privacy information and more details with your desired output.

 

Best Regards
Community Support Team _ Polly

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

Hi @Anonymous , worked like a charm. Thank you.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.