I need to take the DistinctCount(InvNumber) of a InvNumber column by creating a new measures that is #NoofInvoice,
I need to show that column In MY report, but Column #NoofInvoice I want to take on Condition that If(OrderType='SALES' and OrderType is a column which contain two values SALES and RETURN or then only I need distinctcount(InvNumber)) in Power bi
How about if you create a new measure called "No. of Invoices" like this:
No. of Invoices = CALCULATE(DISTINCTCOUNT(InvNumber), FILTER(Table_Name, 'Table_Name'[OrderType] = "Sales"))
Let me know how you go with it! :)
Related
I have a table and a What if Parameter Slicer as shown in the image below,
What I want to do is make the Slicer interact with the Table, that is, if the Slicer value is greater than any of the Total Sales value of any customer, then that customer should be filtered out from the table.
How do I make sure of this?
I tried to add a Visual Filter on the Total Sales Column and tried to do this, Filter out all the values where Total Sales < Slicer Value, but it also didn't work for me. As it doesn't allow me to add "Slicer Value" attribute in the Visual Filter.
You can download the related Workbook from here: https://drive.google.com/file/d/15x7m3nXdlRgHdPBxOGqrJRVYYX8hEgLp/view?usp=sharing
Why I am doing this using a What-If Parameter and not by simply adding Sales Column as Slicer, is because I want to use the value of this slicer to create additional measures. That is something I can't do with Sales Column
I have a solution for you! Instead of using column , You need to create a measure first using this DAX Code:
Total Sales = CALCULATE(
SUM(transactions[sales_amount]),
transactions[sales_amount] >= SELECTEDVALUE('Sales Amount Filter'[Sales Amount Filter]))
Then If we test it on the same visual:
I hope This is what you want to have in the end!
I am trying to create a column in Power BI to group the rows of that data on.
I want the column to output text based on a comparison of dates.
Example:
projected = if(staticdate1 > dynamicdate, "XX", if(staticdate1 < dynamicdate && staticdate2 > dynamicdate, "YY", .... )
The dynamicdate presumably would be a filter or slicer the user could click a date on, thus changing the output of the column, and the totals per output would also change.
Is this possible? I've tried SELECTEDVALUE() but that didn't work. I tried creating a "what-if" parameter and adding that to a static date, but that didn't change anything when I changed the parameter.
That’s not possible since calculated columns are static and don’t recalculate on filter changes. This works with measures only.
I am super new to power bi and Dax and i need to create a calculated column in which i have the total sales for each country respectively.
Here is a screenshot with an oversimplified scenario but if i can do it for this data i can do it in my actual project since the concept is the same.
The column TotalSalesPerCountry is the calculated column.
And here is what the column should look like if it worked. (Colors are just for visual representation)
Basically everywhere you see the same country you should see the same TotalSalesPerCountry values which are calculated by sum-ing the Sales for those countries over the years.
Another DAX function:
= CALCULATE(SUM(CountrySales[Sales]), FILTER(CountrySales, CountrySales[Country] = EARLIER (CountrySales[Country])))
This is simple to do in DAX. Add the column:
TotalSalesPerCountry =
var curCountry = yourTable[Country]
return CALCULATE(SUM(Sales), FILTER(yourTable, curCountry = yourTable[Country]))
Explanation:
For each row in the table, get the country. Filter yourTable on the curCountry and SUM this together).
I have my data(file name - Data) which I have imported in power bi with a column named values
values
ext
int
safety_int
outside_training
gap_fill_int
so it is a large data, and it contains more than 2k categories , what I want is, to create a new column in power bi where blanks should be replaced with target_emp, and all other values(ext,int,gap_filling_int etc.) should be replaced with non_target_emp.
Please help me to do that in power bi.
In powerbi transform ->
Add Column:
if Text.Trim([category]) = "" then "target_emp" else "non_target_emp"
You could add a conditional column in the data model (sorry that I dont have an English screenshot for this):
Add column
Select conditional column
Add criteria to selection
#1 DAX
calculatedColumn= SWITCH(TRUE(), Data[Column1]=BLANK(),"target_emp", "non_target_emp")
#2 using PBI's binning
go to report view->click on the table->column name-> New Group
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]