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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

expend table give me the wrong number

hi i have a measure that take all the [sihpped product - return product ]

this is the measure :

 

INB=
var _MaxDate = MAX(DimDate[Date])
VAR _INB =
CALCULATE(
CALCULATE(
CALCULATE(COUNT('FACT'[DOCDES]),
    FILTER('FACT', 'FACT'[DOCDES] = "Shipped"),FILTER(DimDate,DimDate[Date]<=_MaxDate)),ALL(DimDate))
-
CALCULATE(
    CALCULATE(COUNT('FACT'[DOCDES]),
    FILTER('FACT', 'FACT'[DOCDES] = "return"),FILTER(DimDate,DimDate[Date]<=_MaxDate)),ALL(DimDate))
)
RETURN 
IF(_INB<0, BLANK(), _INB)

 

when i insert the mesure to a table i got the coorect numbers
part name (from dim parts) INB
x

3

total

3

but when i add customer name from the dim customer the number are incorrect 
 
part name (from dim parts) customer nameINB
x

1

1

x

2

1

x

3

5

total 

 

3

the total will be fine after i will add the customer name but the deatiles are wrong 
 
Thanks 
3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

Can you provide some source data for testing? It can be an excel picture or a simple pbix document to remove sensitive information.

 

Look forward to your reply.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Try like

 

INB=
var _MaxDate = MAX(DimDate[Date])
VAR _INB =
CALCULATE(COUNT('FACT'[DOCDES]),
FILTER('FACT', 'FACT'[DOCDES] = "Shipped"),FILTER(ALL(DimDate),DimDate[Date]<=_MaxDate))
-
CALCULATE(COUNT('FACT'[DOCDES]),
FILTER('FACT', 'FACT'[DOCDES] = "return"),FILTER(ALL(DimDate),DimDate[Date]<=_MaxDate))

RETURN
sumx(values(parts[part name]), IF(_INB<0, BLANK(), _INB) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

it not working,

i'm getiing blank 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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