Tuesday, March 4, 2025

How to Show Zero Sales for the Products with No Sales using DAX in Power BI

How to use DAX to Show Zero Sales for the Products without Sales in Power BI
Scenario:
Let's suppose we have a data model like below:


The Relationships are as follows:


In the above Datamodel, there are some Products that do not have the sales for specific Months like shown below:
When we enable "Show items with no data" on Product Name, then the Net Sales shows the value as Blank for those Products with No Sales.

Net Sales = Sum(fct_Orders_Sample[Net_Sales])


Now the requirement is, user wants to show Zero (0) sales for those Products with No Sales, instead of showing Blank.
We can achieve this Scenario by adjusting the Net Sales measure as per below:

Net Sales Adj =
VAR _ZeroFlag = IF ( NOT ISBLANK(SELECTEDVALUE(dim_Products[Product_ID])),0)
RETURN
Sum(fct_Orders_Sample[Net_Sales])+_ZeroFlag

Result:

--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. If you wish, please share your genuine Feedback or comments only related to this Blog Posts. It is my humble request that, please do not post any Spam comments or Advertising kind of comments, which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose we have a sample Sales data, which is stored with Monthly Snapsh...

Popular Posts from this Blog