Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Need help with DAX | Creating Dynamic values

HERE IS LINK TO PBIX FILE : https://1drv.ms/u/s!Agarkj-fHbLWjgkn-5Cm64lDbHgU 

 

Hello Community, 

 

I have the data where I want to find the Multi product Users by calendar year and in all given years in one visual.   

My approach is  making hard to  acheive it - I have made two columns that are counting IDs in a calenda year and ALL years,  and based on those columns i Made category either single or Multi User.   

condition -1
Total Products in Calendar Year = CALCULATE( COUNT ('Table'[ID ] ) , ALLEXCEPT( 'Table','Table'[Years] ,'Table'[ID ] ))
Categorgy Products in CAL. Year = IF('Table'[Total Products in Calendar Year] >1, "MULTI" , "SINGLE" )
 Condition- 2
Total Products in ALL Years = CALCULATE( COUNT ('Table'[ID ] ) , ALLEXCEPT('Table' ,'Table'[ID ] ))
Category Products in ALL CAL. Year = IF('Table'[Total Products in ALL Years] >1, "MULTI" , "SINGLE" )
 
I want to write a Measure that can slice based on  single calendar year or multipile calendar years and identify if customer has Single or Multi products in that period .  As of now I am using two visuals (bar charts ) and slicer ( Year) .  I want to use  year slicer with one bar chart. 
 
 
I would really appreciate if you can help me with it. 
 
Many Thanks,
Cha.
 
 
 
 
 
 

 

 

 

  • Not sure if this is what you want but I remodeled your table slightly.

    Modified = UNION(SELECTCOLUMNS('Table',"ID",'Table'[ID ],"Year",'Table'[Years],"Scope","This year","Count",'Table'[Total Products in Calendar Year],"Category",'Table'[Category Products in CAL. Year]),SELECTCOLUMNS('Table',"ID",'Table'[ID ],"Year",'Table'[Years],"Scope","All years","Count",'Table'[Total Products in ALL Years],"Category",'Table'[Category Products in ALL  CAL. Year]))

     

    see attached

     

     

     

1 Reply

  • Not sure if this is what you want but I remodeled your table slightly.

    Modified = UNION(SELECTCOLUMNS('Table',"ID",'Table'[ID ],"Year",'Table'[Years],"Scope","This year","Count",'Table'[Total Products in Calendar Year],"Category",'Table'[Category Products in CAL. Year]),SELECTCOLUMNS('Table',"ID",'Table'[ID ],"Year",'Table'[Years],"Scope","All years","Count",'Table'[Total Products in ALL Years],"Category",'Table'[Category Products in ALL  CAL. Year]))

     

    see attached