dax

DAX to Test for Whole Number

荒凉一梦 提交于 2020-08-08 06:49:51
问题 I have a Actuals column like so: ID | Airport ------------ A | 98.4 B | 98.0 C | 95.3 I'm attempting to format the numbers above into percentages for a front-end report. I have this written in a switch statement - for ease I'll just write the logic as an IF boolean. example_measure = VAR Nums = SELECTEDVALUES(Table[Actuals]) VAR FormatNums = IF(DIVIDE(ROUND(nums,1), nums) = 1, format(nums,"0%"),format(nums,"0.0%") - RETURN FormatNums no matter what I do this always returns a number with a

Convert comma separated text to a list of numbers

允我心安 提交于 2020-07-30 11:15:25
问题 In Power BI, I have created a DAX query created with a var giving comma-separated text using CONCATENATEX function. Output like Var = "1,2,3,4,5,6" Now I want to search this var into my table column with syntax Table[col] in {var}. It is throwing an error. I even tried converting the column to string with syntax Convert(table[col], string) in {var} The error is removed but the data doesn't match with column data. 回答1: I found this Power BI community thread that is essentially the same

Convert comma separated text to a list of numbers

爷,独闯天下 提交于 2020-07-30 11:15:17
问题 In Power BI, I have created a DAX query created with a var giving comma-separated text using CONCATENATEX function. Output like Var = "1,2,3,4,5,6" Now I want to search this var into my table column with syntax Table[col] in {var}. It is throwing an error. I even tried converting the column to string with syntax Convert(table[col], string) in {var} The error is removed but the data doesn't match with column data. 回答1: I found this Power BI community thread that is essentially the same

Sum where version is highest by another variable (no max version in the whole data)

扶醉桌前 提交于 2020-07-03 09:08:27
问题 I'm struggling having this measure to work. I would like to have a measure that will sum the Value only for the max version of each house. So following this example table: |---------------------|------------------|------------------| | House_Id | Version_Id | Value | |---------------------|------------------|------------------| | 1 | 1 | 1000 | |---------------------|------------------|------------------| | 1 | 2 | 2000 | |---------------------|------------------|------------------| | 2 | 1 |

How to I use the MAX function in power bi only on the filtered records?

时光总嘲笑我的痴心妄想 提交于 2020-06-27 13:09:35
问题 I am trying to select the record with the latest date, all of the records in the database have these basic columns AssetNumber, WorkOrderNumber, ScheduledEndDate, Department I want to find all the latest work order "date" for each asset in a specific department. I have a basic measure and column to do this but it is not working. How do I filter the records and then apply the max date function. I have tried using ALL, ALLEXCEPT, ALLSELECTED etc. | ASSET | DEPARTMENT | WOSCHED_ENDDATE | |------

How to I use the MAX function in power bi only on the filtered records?

匆匆过客 提交于 2020-06-27 13:08:52
问题 I am trying to select the record with the latest date, all of the records in the database have these basic columns AssetNumber, WorkOrderNumber, ScheduledEndDate, Department I want to find all the latest work order "date" for each asset in a specific department. I have a basic measure and column to do this but it is not working. How do I filter the records and then apply the max date function. I have tried using ALL, ALLEXCEPT, ALLSELECTED etc. | ASSET | DEPARTMENT | WOSCHED_ENDDATE | |------

How to I use the MAX function in power bi only on the filtered records?

喜欢而已 提交于 2020-06-27 13:07:57
问题 I am trying to select the record with the latest date, all of the records in the database have these basic columns AssetNumber, WorkOrderNumber, ScheduledEndDate, Department I want to find all the latest work order "date" for each asset in a specific department. I have a basic measure and column to do this but it is not working. How do I filter the records and then apply the max date function. I have tried using ALL, ALLEXCEPT, ALLSELECTED etc. | ASSET | DEPARTMENT | WOSCHED_ENDDATE | |------

case statement in Dax

雨燕双飞 提交于 2020-06-27 12:45:18
问题 I have the following case when statement: case when ts.wgt_kg / ((hgt_cm / 100) * (hgt_cm / 100)) < 18.5 then 'Underweight < 18.5' when ts.wgt_kg / ((hgt_cm / 100) * (hgt_cm / 100)) between 18.5 and 24.9 then 'Normal 18.5-24.9' when ts.wgt_kg / ((hgt_cm / 100) * (hgt_cm / 100)) between 25.0 and 29.9 then 'Overweight 25-29.9' when ts.wgt_kg / ((hgt_cm / 100) * (hgt_cm / 100)) > 30.0 then 'Obese > 30.0' end as BMI How can i convert it into DAX? I tried to google it but I wasn't able to find

Unable to deploy metadata. reason : The syntax of 'Filter_Table' is incorrect

纵然是瞬间 提交于 2020-06-16 17:25:51
问题 I created the following calculated column. IsRenewal := VAR Filter_Table = SUMMARIZE ( FILTER ( SUMMARIZE ( SUMMARIZE ( FACT_ACCOUNT; FACT_ACCOUNT[ID_LOAN_INFORMATION]; FACT_ACCOUNT[ID_COSTUMER] ); FACT_ACCOUNT[ID_COSTUMER]; "abc"; COUNTROWS ( SUMMARIZE ( FACT_ACCOUNT; FACT_ACCOUNT[ID_LOAN_INFORMATION]; FACT_ACCOUNT[ID_COSTUMER] ) ) ); [abc] > 1 ); FACT_ACCOUNT[ID_COSTUMER] ) VAR Latest = FILTER ( Filter_Table; FACT_ACCOUNT[ID_COSTUMER] = EARLIER ( FACT_ACCOUNT[ID_COSTUMER] ) ) RETURN IF (

DAX VAR defining named variables in the middle of the measure code

别等时光非礼了梦想. 提交于 2020-06-16 02:53:07
问题 I have been presented here with a bizarre exploitation of VAR function. So far I have encountered VAR in the beginning of the measure, right after the equal sign. See the code below: Expected Result = SUMX ( VALUES ( Unique_Manager[Manager] ), VAR SumBrand = CALCULATE ( SUM ( Budget_Brand[BudgetBrand] ) ) VAR SumProduct = CALCULATE ( SUM ( Budget_Product[BudgetProduct] ) ) RETURN IF ( ISBLANK ( SumProduct ), SumBrand, SumProduct ) ) Here VAR is nested deeply inside the measure code. Needless