Forum Discussion
A slicer for a pivot table
- 8 years ago
Hi Ynew
It seems your version of Excel does not support DAX variables
Please try this instead
= IF ( CALCULATE ( DISTINCTCOUNT ( TableName[Products] ), ALLEXCEPT ( TableName, TableName[Customer name] ) ) > 1, "Multiple Type", "Single Type" ) - 8 years ago
Hello Muhammad,
Thank you for your reply. I tried to formulate it in my power BI, but could not figure out your logic. The first and last part of your formulation are not clear for me.
Customer Type =
VAR DistinctCountofProducts =
CALCULATE (
DISTINCTCOUNT ( TableName[Products] ),
ALLEXCEPT ( TableName, TableName[Customer name] )
)
RETURN
IF ( DistinctCountofProducts > 1, "Multiple Type", "Single Type" )
Could you please explain in more details? Have you used this formulation and get the same resutls as we are talking about?
Hi Ynew
The results are shown in the image above.
Did you try it as a calculated column with your full data?
The Formula just counts the distinct number of products for each customer and if it it is more than 1, it is marked as "Multiple Type"
- Ynew8 years ago
Helper I
Hi Muhammad,
Yes I tried, but the tool does not understand the first and last part of your formulation. The highlited parts I mean.
I checked your image, I assume you have formulated in Excel. Even in Excel I could not get the same formulation. Could you please send me the exact formulation you have in power BI?
- Zubair_Muhammad8 years ago
Community Champion
Hi Ynew
It seems your version of Excel does not support DAX variables
Please try this instead
= IF ( CALCULATE ( DISTINCTCOUNT ( TableName[Products] ), ALLEXCEPT ( TableName, TableName[Customer name] ) ) > 1, "Multiple Type", "Single Type" )- Zubair_Muhammad8 years ago
Community Champion