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
Bergh
Helper II
Helper II

I have tried it all!!!

Hi. I have some measures that calculate wrong. I have tried with IF(HASONEVALUE also but it don´t work!!!

Dagsbehov = 

CALCULATE(AVERAGE(calc_bals[consump_day]),FILTER(calc_bals,calc_bals[consump_day]>0))
Antal Byten = 
CALCULATE(AVERAGEX(calc_bals,calc_bals[consump_day]),FILTER(calc_bals,calc_bals[consump_day]>0))/SUMX(pkginstructionmasterlist,pkginstructionmasterlist[partqtyinlvl1])

 

Measure.png

1 ACCEPTED SOLUTION

@Bergh 

Please try

Dagsbehov =
SUMX (
CROSSJOIN (
SUMMARIZE (
calc_bals,
calc_bals[Artikel],
calc_bals[HM-Number],
calc_bals[Forpackning_pakit]
),
VALUES ( 'Table'[Antal i Emb] )
),
CALCULATE (
AVERAGE ( calc_bals[consump_day] ),
FILTER ( calc_bals, calc_bals[consump_day] > 0 )
)
)

View solution in original post

12 REPLIES 12
tamerj1
Super User
Super User

Hi @Bergh 
What is wrong?

In the Dagsbehov, Byte/dag and Antal byte / tim columns shows the wrong totals. I want to get the the total of each column.

 

@Bergh 
What are you slicing by in this table? Do you want the total to sum the visible values?

slicing? Yes I want the total sum

 

@Bergh 
I mean which column(s) is/are placed in the table visual? Unsummarized columns not measures.

The "Dagsbehov" column contains a value how many should be manufactured per day. The problem is that we look 18 days ahead, but some days contain 0. Then I have made this calculation avg_cons =CALCULATE(AVERAGE(calc_bals[consump_day]),FILTER(calc_bals,calc_bals[consump_day]>0)) to avoid including days with 0.
The "Antal i Emb" column contains a value per pallet that is not calculated.
Then I take these two and divide by each other to get the number of pallet changes.

@Bergh 
My question was not about the columns involved in the calculations. My question is about the visual itself. The filter contextr of the visual. Which column(s) create(s) the filter context of the visual? Pallet Number or SKU or something else Like customer or city or a combination of columns? And from which tables in case different tables.

Sorry, I don't understand. 

1.png

Just partnumber, and there is diffrent tables. Artikel and Dagsbehov is from one, Antal i Emb is from another, the rest is measure

All.png

@Bergh 

Please try

Dagsbehov =
SUMX (
CROSSJOIN (
SUMMARIZE (
calc_bals,
calc_bals[Artikel],
calc_bals[HM-Number],
calc_bals[Forpackning_pakit]
),
VALUES ( 'Table'[Antal i Emb] )
),
CALCULATE (
AVERAGE ( calc_bals[consump_day] ),
FILTER ( calc_bals, calc_bals[consump_day] > 0 )
)
)

Thanks it works perfectly

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!

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!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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