Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone,
I m new to DAX and struggling for the last 24 hours to create the measure based on another table but couldn't get it and found the message ( a table of multiple values was supplied where a single value was expected. My calculated column is working fine but I want to create a measure.
calculated column=CALCULATE (
LASTNONBLANK ( Tariff_ExpTHC1[Tariff], 1 ),
FILTER (
Tariff_ExpTHC1,
'Document Line'[Size2] = Tariff_ExpTHC1[Size]
&& 'Document Line'[Activity No_] = Tariff_ExpTHC1[No.]
&& 'Document Line'[Gross Weight] >= Tariff_ExpTHC1[From_Wt]
&& 'Document Line'[Gross Weight] <= Tariff_ExpTHC1[To_Wt]
&& 'Document Line'[LEO Date] >= Tariff_ExpTHC1[From_Date]
&& 'Document Line'[LEO Date] <= Tariff_ExpTHC1[To_Date]
)
)
Tariff_Ex_Document_Line (measure) = CALCULATE(
MAXX(Tariff_ExpTHC1,Tariff_ExpTHC1[Tariff]),
TREATAS(
SUMMARIZE('Document Line’, ‘Document Line'[Activity No_],
'Document Line'[Size2]),
Tariff_ExpTHC1[No.],
Tariff_ExpTHC1[Size]
),
FILTER(
Tariff_ExpTHC1,
VALUES('Document Line'[Gross Weight])>=Tariff_ExpTHC1[From_Wt]
&& VALUES('Document Line'[Gross Weight])<=Tariff_ExpTHC1[To_Wt]
&& VALUES('Document Line'[LEO Date])>=Tariff_ExpTHC1[From_Date]
&& VALUES('Document Line'[LEO Date])<=Tariff_ExpTHC1[To_Date]
)
)
thanks
Hi @Anonymous
First, you have to describe clearly what you want to achieve. Second, measures are not calculated columns. They work in a totally different way and serve a different purpose. There's no direct translation of a calculated column into a measure. So, to get a good answer you have to do the above and I would also whole-heartedly recommend reading this: How to Get Your Question Answered Quickly - Microsoft Power BI Community
Then, after following all the advice, you may stand a good chance to get a good answer.
that is why I need help to create a measure
Using CALCULATE in calculated columns is one VERY BAD idea because you are invoking context transition on each and every row. This has many consequences. One of them being slow code.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
40 | |
27 | |
20 | |
15 | |
8 |
User | Count |
---|---|
71 | |
48 | |
46 | |
20 | |
16 |