cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Helper I

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

1 ACCEPTED SOLUTION
Super User

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

12 REPLIES 12
Super User

Hi @Bergh
What is wrong?

Helper I

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

Super User

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

Helper I

slicing? Yes I want the total sum

Super User

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

Helper I

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.

Super User

@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.

Helper I

Sorry, I don't understand.

Super User

Helper I

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

Super User

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

Helper I

Thanks it works perfectly

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors