I have to recreate the formula from Excel in Power BI.
What I try to achieve:
Excel Example Img
Excel Formulas Img
Every row of the column RAND contains calculation (RAND() in this case) plus a value from the previous period.
When I want to make such calculation in Power BI I receive a Circular Dependency Error.
Here is how I calculate columns in 'Bucket Calendar' table:
Col1 = Rand() * 100 + [Col2]
Col2 = CALCULATE(SUM([Col1]), FILTER(ALL('Bucket Calendar'), [Date] = EARLIER([PreviousDate])))
It cannot be done in Power Query because calculation I'll use instead of Rand() comes from other tables
Please help me to solve this.
Related
I have below table structure:
enter image description here
here I want to put a date slicer in Power BI to filter on dates and return the count of total rows as total in the card as shown below:
enter image description here
simple, the only twist is that I want to have the total of hybrid car added at all times.
i.e.
Brands before 5/25/2020 = 4 Hybrid + 1 Electric = 5
Brands before 12/5/2020 = 4 Hybrid + 3 Electric = 7
I have found a solution, which is creating a view in my database, which jus holds the number count of hybrid car (select count(*) from table where cartype = 'hybrid') and using it to sum with filter rows in power bi - but I am looking for a solution completely in Power BI DAX query.
any measure I have tried to create in power bi is filtered by date slicer and so doesn't work.
Create these measure:
TOTALROWS = COUNT('cars'[brand])
ELECTRIC_NUM = CALCULATE([TotalRows],('cars'),'cars'[cartype]="ELECTRIC")
HYBRID_NUM = CALCULATE([TOTALROWS],ALL('cars'),'cars'[cartype]="HYBRID")
TOTALBYBUSINESSLOGIC = CALCULATE([ELECTRIC_NUM]+[HYBRID_NUM])
Now use the last measure (i.e. TOTALBYBUSINESSLOGIC) to be used in your Card to display the total, Notice the expression diffrence between ELECTRIC_NUM and HYBRID_NUM
(In HYBRID_NUM I have used ALL, All will have it bypass the Date Slicer filter) whereas ELECTRIC_NUM will only proivde sum of rows falling in the active date sliver range.
I'm new to DAX and I'm trying to do something that would be really simple in Excel!
Using data from the same table, I'm trying to add a measure, that calculates my 'TargetCost' column where the 'NameUnit' is '1111'.
if nameunit = 1111 then sum the target cost
In excel the formula would be:
=sumif(nameunit,"1111",targetcost)
How do I write this into a measure in DAX please?
Here you go:
Measure =
CALCULATE(
SUM('Table'[targetcost]),
'Table'[nameunit] = "1111"
)
https://learn.microsoft.com/en-us/dax/calculate-function-dax
I am new in Power BI, I am trying to calculate the percentage based on the rowTotal instead of GrandTotal. for example - with my dataset in excel -
RAW Data is like -
from these raw data I want the calculation like -
Very simple problem to be solved and accept the solution if helping:
From the original table, create the Total measure:
Total = SUM(Sheet2[Compliant]) + SUM(Sheet2[Non-Compliant])
Create the Percentage measure
Percentage = SUM(Sheet2[Compliant]) / (SUM(Sheet2[Compliant]) + SUM(Sheet2[Non-Compliant]))
The outcome using table report
So I have this
Dataset
My wanted result is to create a measure that is a Average of the Value 1 + value 2, split by date and Type
I have created a legit solution with a calculated table
consolidateTable =
SUMMARIZE('Blad2';Blad2[Type];Blad2[Date];"summarized";sum(Blad2[value 1]) + sum(Blad2[Value 2]))
and the result looks like this:
SummarizedTable
with the measure
measure = AVERAGE(consolidateTable[summarized])
I get the wanted
Result
I want to create the whole process in a measure
I'm happy for any input in how to create this measure piece by piece with first filtering the table.
This has got to be the simplest question ever, but after seeing a half a dozen sites I can't figure it out. How do I create a total_sales column in Power BI when I have a price_per_unit column and a quantity_order column?
All I want to do is make a column that says "price_per_unit * quantity_ordered" but all I get are errors about the column not existing, or the SUM calculation wanting a measure, or some such thing.
Thanks
Create a calculated column (not a measure) on the table those two columns are part of and definite is like
Total_Sales = Table1[price_per_unit] * Table1[quantity_ordered]