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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Chavas
Helper II
Helper II

Calculate average per month based on status

Hello all. 
I am struggling with a metric which should be easy, but I do not know why it is not showing the information.
I have a table with the connection status of multiple entities. Each row means a connection status per day per entity, as a sample:

Entity CodeDATEConnection Status
111-08-19A
211-08-19A
311-08-19B
111-08-20A
211-08-20B
112-08-20B
212-08-20C
101-09-20A
201-09-20B
301-09-20C



So I have 4 graphs based on the status showing the total amount and compared with other years. As an example, for Status A:

Chavas_0-1597157804529.png


Nevertheless now I would like to show it in % of the total that month. So I have created the next metric:
 

Status Average = CALCULATE(COUNTA(ConnectionStatus[EntityCode]),ConnectionStatus[Connection_Status]="STATUS A")
/ COUNTA(ConnectionStatus[EntityCode])

Nevertheless when applied to the visual is not showing the proper value but this:
Visual with Metric appliedVisual with Metric applied

In top of that, I would love to make one single metric, not one for each Connection_Status, is that possible? I am not being able to use the SELECTEDVALUE function, but I bet because I cannot apply it into the visual itself.

I have tried to play with the Average(s) functions but are not working properly for me.


Thanks in advance
1 ACCEPTED SOLUTION
Chavas
Helper II
Helper II

I had the visual filtered. Once removed the filter it starts to work.

 

I had created one metric for each status.

View solution in original post

4 REPLIES 4
Chavas
Helper II
Helper II

I had the visual filtered. Once removed the filter it starts to work.

 

I had created one metric for each status.

amitchandak
Super User
Super User

@Chavas , Not very clear. Can you share sample data and sample output in a table format?

 

refer if this can help https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390

Sure, first thing first. There was a Typo, now it is showing all as 1

 
 
 

Visual with Metric appliedVisual with Metric applied



Sample of table:

Entity CodeDATEConnection Status
111-08-19A
211-08-19A
311-08-19B
111-08-20A
211-08-20B
112-08-20B
212-08-20C
101-09-20A
201-09-20B
301-09-20C

My bad...

God, visual filter was applying to the measure that is why it was not working propery.
So, is anyway that I can avoid hardcoding the Filter on the metric and set it on the visual?

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors