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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Vindesh
Regular Visitor

Need Help

Hi,

I have 3 tables (PrimarySales,SecondarySales and Hierarchy).

Territory Column is common among them and i have joined Hierarchy table with PrimarySales and Secondary sales table on common Key(Territory).

Now, I want to have a mesure which can give me count of Territory whose Secondary sales is <90% of Primary Sales or vice versa.

Please guide and help to achieve the same.

10 REPLIES 10
PaulDBrown
Community Champion
Community Champion

Can you show a depiction of how the model is set up please?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Testpic.jpg

Ok, you need a couple of measures (+ the sum for the sales in each table)

Sales 1 where S2 > 90% =
VAR _90Threshold =
    DIVIDE ( [Sum Sales 1], [Sum Sales 2] )
RETURN
    IF ( _90Threshold > 0.9, 1 )
Final = 
SUMX(VALUES('Hierarchy'[Region]), [Sales 1 where S2 > 90%])

result.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi,

Many thanks for your reply ans yes same objective even i want to achieve which i rflecting in your image.However,request you to explain bit in detail for measure creation part.

The first measure, [

Sales 1 where S2 > 90%

Returns the value 1 when the division of the primary sales by the secondary sales is greater than 0.9 (90%)

The second measure,

Final

Sums these 1 values to obtain the total.

 

I've attached the sample PBIX file for you

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi 

Many thanks, this has worked for me.

However, one challange is it is giving me count which include duplicates territory names since my hierarchy table contains duplicates.

Not able to figure out to hoe to get distinct count in sumx.

Please guide/help

I'm not sure what you mean. The relationships stemming from your Hirarchy table are on the "One" side, which means they are unique values. There should be no duplicates.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hierarchy table contains duplicates of territory name since its on brand level.

If any territory is bound to sell more than one brand than for that territory there is more than one record in hierarchy table.So i ahve modified your dax in to below one

FInal Count = CALCULATE(DISTINCTCOUNT(Master[Territory-22]),FILTER(Master,'Measure'[90% SS])).
 
However this is also not working for all the records correctly because its considering those records also where either one of the conditons is met.
 
90% SS =
VAR _90Threshold = DIVIDE([Total SS],[Total PS])
VAR _90ThresholdAch = DIVIDE([Total PS],[Total Tgt])
RETURN
IF(AND(_90Threshold > 0.9,_90ThresholdAch > 0.9),1)
 
In below image you can see for siliguri also it is giving me a count.
 
Vindesh_0-1660560137831.png

 

Please share some non-confidential sample data or PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






amitchandak
Super User
Super User

@Vindesh ,  Try measure like

 

Sumx(Filter(values(Hierarchy[Territory]), [Secondary Sales measure] >90 ) , [Secondary Sales measure])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors