How to show count of item on Slicer? | Deep Dive Into PowerBi
The previous article of this series was about What are the Data Sources available in PowerBi. If you want to read the previous article click on the link
In this article, we will learn how we count the number of products and show them on the slicer. This is the general requirement of the client and we have to use DAX function to do this task.
Let’s start
To show the count of the product on slicer we have to first check the data and find the column name that has product info.
I am used data that is about grocery sale and Item Type column is using in today's task.
Now we have to create a new calculated table using a combination of DAX function.
newsales = SUMMARIZE(Sales, Sales[Item Type],
"_ProdCount",COUNT(Sales[Item Type])+ COUNTBLANK(Sales[Item Type]),
"_ProdNameCount",CALCULATE(IF(ISBLANK(VALUES(Sales[Item Type])),"Blank()",VALUES(Sales[Item Type])) & " (" & COUNT(Sales[Item Type])+COUNTBLANK(Sales[Item Type]))&")")
After the Execution of this function, a new sales table is created.
It’s time to plot data of the new sales table into the slicer. And I add table visual also to show to guys’ new sales table
After complete all the above processes, your dashboard page will be.