Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RegionH
Helper I
Helper I

Duplicated rows when adding a measure to a table visual

I have a datamodel where I have a fact table 'ZMM_INDI - uden dubletter'. This table is connected to a dimension table 'Suppliers' on Supplier ID. The table suppliers has more suppliers than represented in the fact table ' ZMM_INDI - uden dubletter'. 

 

RegionH_1-1700484625268.png

 



When I add the measure 'Lagerdækning/uger (avg 30 dage) to a visual table, then I get duplicated rows like this. I would expect only to see the first row with the value 0,61. 

RegionH_0-1700484268564.png

The measure 'Lagerdækning/uger (avg 30 dage) is calculated like this:

 

Lagerdækning/uger (avg 30 dage) = 
    VAR TotalAntal = 'ZMM_INDI - Uden dubletter'[Beholdning minus udløbet]
        
    RETURN
    IF(
        TotalAntal = 0,
        0,
        calculate(30 / 7 * divide(TotalAntal, sumx('ZMM_INDI - Uden dubletter', 'ZMM_INDI - Uden dubletter'[Udleveret 30 dage (basisenhed)])
    )))

 

 

What causes the problem with duplicated rows in the visual table?

 

Best regards

Morten

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

The whole row is not duplicated.  What you see is powerbi giving you all the combinations of the dimension and fact table for which the measure returns a non-blank value.

This part

IF(
        TotalAntal = 0,
        0,

returns a 0 for all rows where the measure Beholdning minus udløbet is 0.  I don't know what that measure does but it looks like it returns 0 for all the combination that could be in the visual

--

In powerbi, we sometimes use this feature to our advantage by adding 0 to a measure, for example, show me all the customers who have sales and also show me the customers who have no sales.  The measure above does something similar

 

--

In any powerbi visual, when a measure returns blank, the rows will be removed from that visual.

View solution in original post

2 REPLIES 2
RegionH
Helper I
Helper I

@HotChilli Thank you for the explanation. The variable 'TotalAntal' uses 'ZMM_INDI - Uden dubletter'[Beholdning minus udløbet], which calculates how much is in stock minus the amount that has expired. I took over the data model from someone else, so I don't know why we want to show 0 instead of just blank.

HotChilli
Super User
Super User

The whole row is not duplicated.  What you see is powerbi giving you all the combinations of the dimension and fact table for which the measure returns a non-blank value.

This part

IF(
        TotalAntal = 0,
        0,

returns a 0 for all rows where the measure Beholdning minus udløbet is 0.  I don't know what that measure does but it looks like it returns 0 for all the combination that could be in the visual

--

In powerbi, we sometimes use this feature to our advantage by adding 0 to a measure, for example, show me all the customers who have sales and also show me the customers who have no sales.  The measure above does something similar

 

--

In any powerbi visual, when a measure returns blank, the rows will be removed from that visual.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.