Forum Discussion
Creating variables in power bi
I have so many tables. I want to create variable .. I searched on google and found that by going Home-->new measure you will create new variable but click on this looks like we have to create in table but i dont want to create variables in table.. i want to create variable and then i want to call in KPI or in graph . . like just we do in qlik sense we simply click on variable button and then box appear and on that we create many variables without adding them in table like they are just separate from tables..
this is what i want that create variables in separate and then call them in KPI.. is that possible
like i have this
Total_Sales_Variable =
IF (
VALUES ( 'VBRK_BillingDocument_Header'[Billing Doc.currency_WAERK] ) = "USD",
[vCurrency],
1
) *
CALCULATE (
SUM ( 'VBRK_BillingDocument_Header'[Billing Sales Amount_NETWR] ),
FILTER (
'VBRK_BillingDocument_Header',
'VBRK_BillingDocument_Header'[Fiscal Year] = 2016 ||
'VBRK_BillingDocument_Header'[Fiscal Year] = 2017
),
FILTER (
'VBRK_BillingDocument_Header',
'VBRK_BillingDocument_Header'[Billing Type_FKART] <> "ZG2" &&
'VBRK_BillingDocument_Header'[Billing Type_FKART] <> "ZL2"
)
)4 Replies
- AnonymousNot applicable
First, some Power BI vocabulary:
Measure: value that is calculated at query run-time.
Calculated Column: value that is stored row-by-row.
Variable: value that is calculated within a Measure/Calculated Column/Calculated Table to make code easier to read and faster.
It looks like what you want are Measures.
To assess performance, you presumably want to compare 2 measures: The Target and the Actual.
Then, add a KPI visual and include your Target and Actual measures. You'll also need to specify a trend axis.
Cheers!
Nathan
- BakhtawarPost Patron
no .. i want to create varaibles. .
- v-frfei-msftCommunity Support
- BakhtawarPost Patron
i try this but this shows an error
i have this formula
Total_Sales_Variable = IF ( VALUES (BillingDocument_Header[Billing Doc. currency_WAK] ) = "USD", 139.2, 1 ) * CALCULATE ( SUM (BillingDocument_Item[Sales Amount_NEWR]), FILTER ( 'Invoice_Calender', 'Invoice_Calender'[Fiscal_Year] = 2016 && 'Invoice_Calender'[Fiscal_Year] = 2017 ), FILTER ( 'BillingDocument_Header', 'BillingDocument_Header'[Bill Type_FKRT] <> "Z2" && 'BillingDocument_Header'[Bill Type_FKRT] <> "Z2" ) )when i add this shows an error
MdxScript(Model) (8, 5) Calculation error in measure 'Invoice_Calender'[Total_Sales_Variable]: A table of multiple values was supplied where a single value was expected.
any help ?