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
jegio
New Member

Taking the Median of a Measure

Hello,

I'm new to the community and need a little help.

 

I have a table that has one row for each transaction, and I was able to make a Measure that counts the number of transactions pretty easily:

     CountTransactions = Count('Store1'[Index])

This works fine, and adjusts to input from the slicers. Particularly, I want to apply it so I can see the number of Transactions that each customer makes each quarter, and slicing on "CustomerName" and "Quarter" gives me just that.

 

What I would like now is to find the medium number of transactions that occur between customers within the store each quarter. Is there a way to use a measure to take the median of this measure?

When I try to reference the above measure using the following formula:

     MedianTransactions = Median('Store1'[CountTransactions])

I get the error "Column 'GethelpCases' in table 'Gethelp' cannot be found or may not be used in this expression."

 

I'm guessing that this is because I am trying to reference a Measure inside a Measure, Is there a way to do what I am trying to do?

 

 

1 ACCEPTED SOLUTION
alanhodgson
Solution Supplier
Solution Supplier

Hey @jegio,

 

You could make the first COUNT function a Calculated Column instead of a Measure, then create the measure using the MEDIAN function on the calculated column.

 

CalculatedColumn = Count('Store1'[Index])

Measure = Median('Store1'[CalculatedColumn])

Best,

 

 

Alan

View solution in original post

3 REPLIES 3
alanhodgson
Solution Supplier
Solution Supplier

Hey @jegio,

 

You could make the first COUNT function a Calculated Column instead of a Measure, then create the measure using the MEDIAN function on the calculated column.

 

CalculatedColumn = Count('Store1'[Index])

Measure = Median('Store1'[CalculatedColumn])

Best,

 

 

Alan

Hi @alanhodgson,

 

Thank you for taking the time to reply to me.

 

When I try that solution for the calculated column, I get the total number of transactions in the table instead of the number of transactions for each account. Each row shows "6000", and I think thats because PowerBI calculates all of these columns statically upon refresh instead of dynamically.

 

I read somewhere that when creating something that needs to respond to slicer input, it needs to be a measure. In this case, I think that the Count of Cases needs to be a measure, right?

 

Thanks,

Jeff

Hi @jegio,

 

It show be a measure, if you use the calculated column it will calculate all of the list.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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.