Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Analyzing Complex DAX to get values for each row?

Hey All,

 

Trying to understand where this code is going wrong. I am getting results for INT11 but not INT1-10. Result below. I understand I casted a function that puts in counts greater or equal to 11 to INT 11. But now im not seeing counts from 1-10.

 

Here all im trying to do it count of a count. For e.g.

ABC0
ABC1
ABC1

 

Then Result table (so basically if theres 2 instances of 1 count, then i want INT2 to show INT2, if ABC had 3 line items of 1, that would be associated to INT3.

INT 10
INT 2

2

Count of INT Final - DL = 
var _int = SELECTEDVALUE(INT_SORT[INTRANK])
var tab = 
SUMMARIZE(
DISTINCT(PROD[DEVICE_LOCATION]),
PROD[DEVICE_LOCATION],
"Count",
COUNTX(
FILTER('PROD'
, 'PROD'[IMPBY_DEVICELOCATION] <> 0), 1
))
var newtab = 
ADDCOLUMNS(
tab,
"Result",
"INT" & 
IF( COUNTX(
FILTER('PROD'
, 'PROD'[IMPBY_DEVICELOCATION] <> 0), 1
) >= 11, 11, 
COUNTX(
FILTER('PROD'
, 'PROD'[IMPBY_DEVICELOCATION] <> 0), 1
))
)
return
COUNTROWS(
FILTER(
newtab,
[Result]=_int
)
)

 

 

 

Result im getting for this dAX

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    If everything is getting 0 and only INT11 is getting a number.

    How is Total 1,180,464?

     

    Is there some condition changing the value to 0?

     

    Did I resolve your issue? Mark my post as a solution!

     

    Appreciate your Kudos, Press the thumbs up button!!

     

    Regards,
    Pranit

  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi , Anonymous 

    The information you have provided is not making the problem clear to me. Can you please explain more details about this dax.

    You also  can upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

     

    Best Regards,
    Community Support Team _ Eason