The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am having a date filter with values year, month and day. I am having a table with two columns - one with code (it has duplicates) and corresponding productions for the day selected. I tried the following measure but its wrong.
CALCULATE(SUMX(VALUES('WASTAGE'[CODE]), AVERAGE('WASTAGE'[PRODUCTION])))
Can anyone help ?
Solved! Go to Solution.
Hi , I found a working solution to the above problem. Im adding it here just for reference.
NTest =
var x = SUMX(SUMMARIZE(WASTAGE,(WASTAGE[CODE]), "Summ", sum(WASTAGE[PRODUCTION])), [Summ])
var y = count(WASTAGE[PRODUCTION])
return
x/y
NTest1 =
VAR a = VALUES( WASTAGE[CODE] )
VAR Result = SUMX(a,[NTest])
RETURN
IF(HASONEFILTER(WASTAGE[CODE]), [NTest], Result)
Hi @Anonymous
Can you provide more details about the data and expected output? Sample data. The problem statement is not very clear.
Regads
Hi @qqqqqwwwweeerrr , thanks for your response.
Iam having a date filter. On selecting the date I want (4th-jan-2023 here) i want to calculate the total sum of averages of the production wrt to the code i.e ((800+800+.....+800)/7) + ((11776+ 11776+ .....11776)/5) => 800+11776 = 12567
I have tried the following measure ,
Total_production = SUMX(VALUES('WASTAGE'[CODE]), AVERAGE('WASTAGE'[PRODUCTION]))
and im getting 10,746 as the result for the above data which is wrong. Any help is appreciated.
Thanks.
Hi , I found a working solution to the above problem. Im adding it here just for reference.
NTest =
var x = SUMX(SUMMARIZE(WASTAGE,(WASTAGE[CODE]), "Summ", sum(WASTAGE[PRODUCTION])), [Summ])
var y = count(WASTAGE[PRODUCTION])
return
x/y
NTest1 =
VAR a = VALUES( WASTAGE[CODE] )
VAR Result = SUMX(a,[NTest])
RETURN
IF(HASONEFILTER(WASTAGE[CODE]), [NTest], Result)
User | Count |
---|---|
27 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
7 | |
6 |