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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors