While I am trying to create a new measure, with condition, I am facing the below error.
I am trying to create a dynamic line based on dates on my line graph. For my case, if Sheet[Date] matches to Test[Date] it should return me a value of 100.
But the error says that a single value for column 'Date' in table Sheet1 cannot be determined.
I also tried to convert the date to week with Weeknum function. But the error still persists.
Does it mean that I can not compare single values in IF condition
If there is a way to compare the dates, kindly guide me.
Sheet[Date] and Test[Date] are columns, not single values.
You need to specify which single values from those columns to compare. For example, you could compare the maximal values of those columns (within the local filter context):
MAX ( Sheet[Date] ) = MAX ( Sheet[Date] )
Related
I have a table like this:
I would like to calculate the result but some of ID column has different calculation formula.
For ID less or equal to 1733 using this formula: Value/3*100 for ID greater than 1733 using this formula Value*100
I tried this way:
Result =
IF('Data'[ID]<=1733,[Value]/23*100)
IF('Data'[ID]>1733,[Value]*100)
But it return an empty value. Anyone could help me please.
Thank you so much
This can be achieved using IF statement by following way by creating a calculated column called "Result"
Result = IF(Data[ID]<="1733",(Data[VALUE]/23)*100,Data[VALUE]*100)
Hope this helps !!
If the [ID] is a text then you can convert it to a number with the VALUE(). When you are trying to convert number to text with quotes then you will get a wrong result for some of values. For text comparison it works like this: "11111"<"2", for number 11111 > 2. For a calculated column it not necessary to write a full column name like 'Data'[ID], you can simply write [ID], because of a row context. DAX will understand that the value and row you are working with is in a current table.
Result =
SWITCH(
TRUE()
,VALUE([ID])<=1733,[VALUE]/23*100
,[VALUE]*100
)
The Films table looks like this
There is a ComfortBreaks table looking like image
In the Films table I need to create a calculated column called NumberBreaks which shows for each film the number of breaks needed. To do this I have to pick out the value of the Breaks column where:
The value of the lower limit in the ComfortBreaks table is less than or equal to this film's running time in minutes
and
The value of the upper limit in the ComfortBreaks table is greater than this film's running time in minutes.
the result should look like the image below
There cannot be a relationship between the two tables. so this has to be done without creating relationship between them.
I tried lookup function but it showed error:A table of multiple values was supplied where a single value was expected.
You can use this below code for your custom column. Considering
number_of_breaks =
VAR current_row_run_time_minutes = Films[RunTimeMinutes]
RETURN
MINX (
FILTER(
ComfortBreaks,
ComfortBreaks[LowerLimit] <= current_row_run_time_minutes
&& ComfortBreaks[UperLimit] > MonthNumber
),
ComfortBreaks[Breaks]
)
You can perform your further average calculation on the new custom column now.
Objective:
I would like to make a measure and a calculated column (for the sake of knowing how to write both) using an IF statement but can't get it to work
Query:
Column =
IF(
Refund[orderTotalPrice]=Refund[amount] && Refund[status] = 'refund' ,
Refund[amount] - Refund[total_tax]- Refund[shipping_price],
Refund[amount]
)
the expression refers to multiple columns multiple columns cannot be converted to a scalar value
When creating an if statement in a calculated column you can only have one comparison statement. If you want 2, like in your example, you need to use the AND function. Also make sure you use " instead of ' for string comparison.
I tested this calculated column and this worked for me:
Column = if(
AND(Refund[orderPriceTotal]=Refund[amount],Refund[status]="Refund"),
Refund[amount] - Refund[total_tax] - Refund[shipping price],
Refund[amount]
)
In your case, I do not think there is an easy solution to solve this in a measure. Why would you want to build it as a measure?
I have 2 column; ID CODE, value
Remove duplicates function will remove the examples with the higher value and leave the lower one. Is there any way to remove the lower ones? The result I expected was like this.
I've tried Buffer Table function before but it doesn't work. Seems like Buffer Table just works with date-related data (newest-latest).
You could use SUMMARIZE which can be used similar to a SQL query that takes a MIN value for a column, grouped by some other column.
In the example below, MIN([value]) is taken, given a new column name "MinValue", which is grouped by IDCode. This should return the min value for each IDCode.
NewCalculatedTable =
SUMMARIZE(yourTablename, yourTablename[IDCode], "MinValue", MIN(yourTablename[value]) )
Alternatively, if you want the higher values just replace the MIN function with MAX.
I am trying to add two currency columns in a calculated column but am getting a #NULL! error.
This seems pretty straightforward but its my first time doing this in SharePoint.
SharePoint 2010 with Excel Services available.
Have create List with required columns:
Approved Value column Type = Currency
Pending Value column Type = Currency
Total Value column
Calculated (calculation based on other columns)
Type = Currency
Formula: =[Approved Value]+[Pending Value]
The values in other columns are indeed currency, but the Total shows #NULL! for all items.
I can't see anything done incorrectly.
What should I be looking for to resolve this problem?
Try using the ISBLANK function to previously check if any of the value is null.
Reference: ISBLANK function
I ended up using NZ(Value, 0)
=NZ([Approved Value],0)+NZ([Pending Value],0)
Though not sure how NULLs ended up in field or why SharePoint couldn't deal with them without this special treatment.