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
Anonymous
Not applicable

Measure to know the total percentage by category

I have two tables in SSAS that have one column for Budget, another table with Accomplished, and another table that has the list of branches.

I need to create a measure that aggregates the sum for each branch, compare if the goal has been exceeded, if so, check TRUE if not as FALSE.

 

Capturar.PNG

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi
 
1.First create a measure that tells which subsidiaries did not reach the goal
 
budget sum = CALCULATE(SUM(Table13[budget]),ALLEXCEPT(Table13,Table13[branch]))
accomplish sum = CALCULATE(SUM(Table13[accomplish]),ALLEXCEPT(Table13,Table13[branch]))
Measure 3 = IF([budget sum]>[accomplish sum],"True","Flase")
 
2.Calculate the percentage of how many could not reach the target against the total number of branches.
 
Does the row with “true” mean not reaching the target, if so,
Total true = CALCULATE(DISTINCTCOUNT(Table13[branch]),FILTER(ALL(Table13),[Measure 3]="True"))
Total flase = CALCULATE(DISTINCTCOUNT(Table13[branch]),FILTER(ALL(Table13),[Measure 3]="Flase"))
the total number of branches = CALCULATE(DISTINCTCOUNT(Table13[branch]),ALL(Table13))
percentage = DIVIDE([Total true],[the total number of branches])
5.png
3.have a gauge graph
add measure “the total number of branches” to Max field, “Total true” to Pointer value field, “percentage” to Percentage field.
6.png
 
Best Regards
Maggie

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi
 
1.First create a measure that tells which subsidiaries did not reach the goal
 
budget sum = CALCULATE(SUM(Table13[budget]),ALLEXCEPT(Table13,Table13[branch]))
accomplish sum = CALCULATE(SUM(Table13[accomplish]),ALLEXCEPT(Table13,Table13[branch]))
Measure 3 = IF([budget sum]>[accomplish sum],"True","Flase")
 
2.Calculate the percentage of how many could not reach the target against the total number of branches.
 
Does the row with “true” mean not reaching the target, if so,
Total true = CALCULATE(DISTINCTCOUNT(Table13[branch]),FILTER(ALL(Table13),[Measure 3]="True"))
Total flase = CALCULATE(DISTINCTCOUNT(Table13[branch]),FILTER(ALL(Table13),[Measure 3]="Flase"))
the total number of branches = CALCULATE(DISTINCTCOUNT(Table13[branch]),ALL(Table13))
percentage = DIVIDE([Total true],[the total number of branches])
5.png
3.have a gauge graph
add measure “the total number of branches” to Max field, “Total true” to Pointer value field, “percentage” to Percentage field.
6.png
 
Best Regards
Maggie
Anonymous
Not applicable

Hi @v-juanli-msft, this solution is great! But I'm having trouble to count the booleans.

 Capturar.PNG

 

It may have something to do because the budgets, accomplish, and branch tables are separate in the data model.

 

Diagram.PNG

My formulas:

 

Sum Budget:= CALCULATE(SUM(Budget[Budget]);ALLEXCEPT(Branches;Branches[abbrevbranches]))
Sum Accomplish:=CALCULATE(SUM(Accomplished[Accomplished]);ALLEXCEPT(Branches;Branches[abbrevbranches]))
Deviation:=IF([Sum Budget] > [Sum Accomplish];"TRUE";"FALSE")
Total True:=CALCULATE(DISTINCTCOUNT(Branches[abbrevbranches]);FILTER(ALL(Accomplished);Accomplished[Deviation]="TRUE"))
Total False:=CALCULATE(DISTINCTCOUNT(Branches[abbrevbranches]);FILTER(ALL(Accomplished);Accomplished[Deviation]="FALSE"))
Total branches:=CALCULATE(DISTINCTCOUNT(Branches[abbrevbranches]);ALL(Accomplished))
Percentage:=DIVIDE([Total True];[Total branches])

 

Anonymous
Not applicable

Finally I did, it was necessary to change two more formulas:

 

Count FALSE:= COUNTROWS(FILTER(DISTINCT(Filiais[SiglaFiliais]);[Deviation]="FALSE"))

Count TRUE:= COUNTROWS(FILTER(DISTINCT(branches[abbrevbranches]);[Deviation]="TRUE"))

 

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.