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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jrwjr_eng
Regular Visitor

DAX help with a conditional classifer

I may be making this more difficult than needed....

 

I have a data table that I would like to filter with complex conditioonsn and then classifiy into a measure for pivot reporting.

 

See the below example.  DimINS may be extra\unneeded.  I have defined the measures I am looking to pivot with the report example at the bottom.

 

Thanks for helping in advance.  It all seams to foggy when it really should be simple dynamic conditions.

 

RunningTbl   dimT_Bunch dimINS    
InvoiceRunCodeInsid RuncodeBunch InsidName   
123104Red TT5 RedRed Inidustry   
123TTBlue TF5 BlueBlue Induistry   
123TGBlue 1043      
124104Blue 1253      
124101Blue 1013      
124TTBlue         
125104Red         
125127Red         
125TFBlue         
126104Red         
127104Blue         
            
            
  Reflection = 'Count num of Runcode = "104" and Classify invoice by red or blue bases on Bunch code = "5"
            
  Mirrors = Count num of Runcode = "104" where invoice not classifed by Bunch Code ="5" use Insid 
            
            
   Straight 104 ReflectionsMirrors Bunch 5    
  Red301 0    
  Blue240 3    
1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft Employee
Microsoft Employee

@jrwjr_eng

 

I still can't understand your logic. In your Dim T_Bunch table, your RunCode and Bunch is 1-to-1 relationship.

 

What do you mean "RunCode = 104" AND "Bunch Code=5"?

 

If you are counting the invoices which matches your condition, can you explain why you get those results in the bottom table?

 

Regards

View solution in original post

2 REPLIES 2
v-sihou-msft
Microsoft Employee
Microsoft Employee

@jrwjr_eng

 

I still can't understand your logic. In your Dim T_Bunch table, your RunCode and Bunch is 1-to-1 relationship.

 

What do you mean "RunCode = 104" AND "Bunch Code=5"?

 

If you are counting the invoices which matches your condition, can you explain why you get those results in the bottom table?

 

Regards

Yes, Invoice counts is the goal.

 

Invoice Units = CALCULATE( COUNTX( FILTER('RunningTbl', 'RunningTbl'[bc]="104"), 'RunningTbl'[invoice]))

For unit counts... I need to aggregate the data table by a grouping (for example of Invoice 123 = 104 AND TG, then grouping 5 and classfied by the INSID color of the TG = Blue)

 

I went to look for SQL examples and found a DAX Dynamic Segmentation that is an example of a numeric classifier.  If I can port this over from a numeric range to a alpha index in a parameter table, I may have a way.

 

http://www.daxpatterns.com/dynamic-segmentation/

https://powerpivotpro.com/2014/11/new-twist-for-dynamic-segmentation-variable-grain-range-selection

 

I know I am making this harder than it needs to be.

 

In plain english, I want to test Invoices and if they known combnations of RunCodes to classify them as Reflections or Mirrors.  Then count\total classification as the Insid color for the RunCodes in t_group 5.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.