cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fjvalerach
New Member

Calculate Avg Per Category for All Stores (Other Category Not Displayed in Table)

I am in the process of migrating a dashboard fom Tableau to PowerBI. This is how the final result looks:

 

CategoryAvg. of Work Orders Across all Stores     Distinct Count of Work Orders for Selected Store      
Category 1          103.0129
Category 2          33.142

Category 3          

38.637
Category 4          16.935
Category 5          19.124

 

 

I am displaying the Top 5 Categories by Work Orders Volume for the Selected Store. I have a parameter filter that the user uses to select a store to compare against all other stores in the fleet.

 

Here are how I am calculating these measures in Tableau:

MeasureHow to calculate it    Measure Aggregation
Distinct Count of Work Orders for Selected Store     IF([Store #]=[Store_Parameter]) THEN
[Tracking Nbr]
END
    Count Distinct
Avg. of Work Orders Across all Stores{INCLUDE [Store #] : COUNTD([Tracking Nbr])}    Average

 

I am having a hard time replicating this in PowerBI as I have been searching and nothing comes up with the result I need to display.

3 REPLIES 3
PaulOlding
Super User
Super User

My best guess at the measures are:

 

Distinct Count of Work Orders for Selected Stores = 

DISTINCTCOUNT('Table'[Tracking Nbr])

 

Avg of Work Orders Across all Stores =

AVERAGEX(

ALL('Table'[Store #]),

DISTINCTCOUNT('Table'[Tracking Nbr])

)

Hi PaulOlding,

 

You are right, I forgot to post how the source data looks, here is a sample:

Store    Category       Tracking Nbr (Unique Value)   
1Category 1123
1Category 1234
1Category 2345
1Category 3456
1Category 4567
2Category 1678
2Category 2789
2Category 3890
2Category 4098

 

I tried your example and I got this result:

 

CategoryAvg. of Work Orders Across all Stores     Distinct Count of Work Orders for Selected Store      
Category 1          129129
Category 2          4242

Category 3          

3737
Category 4          3535
Category 5          2424

 

Results for Distinct Count of Work Orders for Selected Store are correct, however as you can see the values are the same for Avg. of Work Orders Across all Stores so this one unfortunately is not correct.

 

 

 

My other question is, once I bring the measure to the table, what should I choose as aggregation for each of these measures? should I just pick: Don't Summarize or should I should Avg?

I just noticed I was creating a New Column rather than a New Measure so this question doesn't make sense.

Thanks,

Anonymous
Not applicable

To be able to give a formula one has to know the model.

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors