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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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) )

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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