Showing results for 
Search instead for 
Did you mean: 
Post Patron
Post Patron

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",
) * 
    SUM ( 'VBRK_BillingDocument_Header'[Billing Sales Amount_NETWR] ),
    FILTER ( 
        'VBRK_BillingDocument_Header'[Fiscal Year] = 2016 ||
        'VBRK_BillingDocument_Header'[Fiscal Year] = 2017
    FILTER ( 
        'VBRK_BillingDocument_Header'[Billing Type_FKART] <> "ZG2" &&
        'VBRK_BillingDocument_Header'[Billing Type_FKART] <> "ZL2"
Community Support
Community Support

Hi @Bakhtawar ,


Did you mean what if parameter?



Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

i try this but this shows an error 


i have this formula

Total_Sales_Variable = 
IF ( 
    VALUES (BillingDocument_Header[Billing Doc. currency_WAK] ) = "USD",
) * 
    SUM (BillingDocument_Item[Sales Amount_NEWR]),
    FILTER ( 
        'Invoice_Calender'[Fiscal_Year] = 2016 &&
       'Invoice_Calender'[Fiscal_Year]  = 2017
    FILTER ( 
        '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 ?

Not applicable

@Bakhtawar  - 

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.






no .. i want to create varaibles. .

Helpful resources

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors