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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
kukszi
Helper I
Helper I

How to organize calculated measures into hierarchies

Hi there,

 

Recently I had a question about how can I extrapolate the national sales if I have partial information only. 

 

Now I need to bring this model to the next level, where the extrapolated values are displayed in a matrix visual, and the products are combined into product hierarchies. E.g Prod 1 and Prod 3 belong to ProdHier1, and Prod 2 and Prod 4 belong to ProdHier2, and also ProdHier1 and ProdHier2 belong to ParentHier1.

 

My problem is when I'm displaying the values in a matrix visual, the subtotals of the extrapolated provinces (AB and SK) are not correct, while the subtotals of the provinces with actual data (BC and ON) are correct:

pbierror.png

 

Can someone please let me know how can I fix the displayed subtotals for the extrapolated provinces?

 

Bonus question: what if I need to organize the customers to hierarchies too (e.g Cust 1 and Cust 2 are "Key Accounts", Cust 3, Cust 4 and Cust 5 are "Other customers")?

 

For reference, the pbix file is uploaded here

 

Thanks,
kukszi

 

@mahoneypat@v-yiruan-msft 

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Try this:

 

Replace the AllExcept part of your Extrapolation total measure with this

 

ALLEXCEPT ( Actuals, Actuals[Product], Actuals[ProdHier] ),
 
This makes it so it doesn't remove the filter from ProdHier.  Add ParentHier column too if you will be using that in the matrix.
 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@kukszi , I changed it, see if works

Extrapolated Total = 
VAR __actuals =
SUM ( Actuals[Volume] )
VAR __extrapolation =
SUMX (
Extrapolate,
Extrapolate[ExtrapolationFactor]
* CALCULATE (
SUM ( Actuals[Volume] ),
ALLEXCEPT ( Actuals, Actuals[Product] ,Actuals[ProdHier]),
TREATAS ( VALUES ( Extrapolate[BaseToBeUsed] ), Actuals[Province] ),
TREATAS ( VALUES ( Extrapolate[Customer] ), Actuals[Customer] )
)
)
RETURN
__actuals + __extrapolation
mahoneypat
Employee
Employee

Try this:

 

Replace the AllExcept part of your Extrapolation total measure with this

 

ALLEXCEPT ( Actuals, Actuals[Product], Actuals[ProdHier] ),
 
This makes it so it doesn't remove the filter from ProdHier.  Add ParentHier column too if you will be using that in the matrix.
 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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