I'm a bit new to the DAX/Power BI, so i dont have broad understanding of it.
I have table 'Sales' as follows:
ItemID SalesValue Amount actionSales Date
1 0.5 2 0 2018-02-18
1 0.3 5 1 2018-02-18
1 0.5 6 0 2018-02-19
-I left out some fileds as description, brand, etc...
-actionSales field is a bit, that represent if sold item was on a discount.
I have made few measures that have total salesValue, total salesValueOnActionSales, percentOfActionSales, etc...
Within visuals in Power BI I can filter values if they are greater or lower then some value.
Then i figured that it would be nice to show only items that have share of action sales greater then 'parameter' (Parametr is a whole number, and it is in visual with a slider) that I made on a report.
After some time, I'm no closer to a solution. Can this be made? if it can, can someone please point me to a direction on how to do this or share some insights on the matter.
Cheers
This can be done with the 'What If' parameter in PowerBI. In short: you define a parameter, connect it to a slicer and use the parameter in a measure.
Link to MSDN Docs
Can you not add the actionSales column to a slicer and select Greater than or equal to from the options?
If this doesn't work let me know and I have another solution that might do it.
Related
I am learning Power BI Desktop. I have a project already loaded for which I have created a
pie chart.
As you can see, the data is currently divided into two years: 2022 and 2021.
I also have data for previous years that I want to include in the chart. Unfortunately, none of these years has a high number. So I want to group them all into an "Other" category.
I've already tried using the RANKX function as described here (where I copied and pasted the formula from the comment and replaced the field name with my own) and here (where I went through the article step by step using my own field names). I used the exact format shown in both the comment and the article:
Rank = RANKX('Table','Table'[Percent],,DESC,Dense)
(Table is the table name I am using and Percent is the column I am trying to rank.)
When I added the new column to a table, though, PowerBI automatically gave me a sum calculation. This calculation gave me a 1 in each column. When I asked it not to give me a sum, it said it could not display the visual and took me back to the calculation screen.
EDIT: Thanks for your help Kevin! This is the table I tried to draw from. I am an idiot sometimes.
EDIT 2: Now I am trying to use a different field in the formula:
Rank = RANKX('FactClaimActivity','FactClaimActivity'[DirectIncurredLoss_ITD])
(This is the original field that I tried to base Percent on)
My table looks like this. (Yes, I know that 2016, 2017, 2019 and 2020 have negative values and 2014 and 2015 have $0 values. I just want to show what the data is.)
EDIT 3: This time I am also getting an error when I type in the formula, which says "A single value for column 'DirectIncurredLoss_ITD' in table 'FactClaimActivity' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
I do not understand why it wants a single result for a formula that ranks the data points based on this field. That seems like it defeats the whole purpose of the formula.
Yet when I use the formula, I get the same result as last time! This column is in the Fixed decimal number format, and it does have many different values.
EDIT: I've found the answer
New Category = IF('FactClaimActivity'[Rank]<=2,'FactClaimActivity'[LossYear],"Other")
The formula will help you get the correct result.
I'm new to tableau. my question is, is DAX from Power BI same as LOD in Tableau?
It'd be great if someone could help me with an explanation for this.
thanks in advance!
There are similarities for sure. In Excel it can be a way to display a value that is unaffected by filtering.
LODs are similar in that you can fix your value.
For example, if I want to know the total sales in a workbook regardless of what row/column the value is on, I could use a FIXED LOD expression:
{FIXED : SUM([Sales]}
If you put the above on Label and a Month dimension on rows, it will ignore the segmentation of months and display the total sum of sales for the entire workbook.
You can choose to fix on a different level of detail to achieve a different result:
{FIXED [Month] : SUM([Sales]}
If you put the above on Label and a month and date dimension on rows it will display the total sum of sales for each month, and ignore the date. And so on...
They're somewhat tricky to get used to, but they come up a lot in more complex workbooks.
I would put it this way, the DAX language is at least as powerful as Tableau expressions (involving LOD or otherwise). That is, if you can do it with Tableau LOD, then there's also a way to write something equivalent with DAX.
I am trying to rank my table values as 1,2,3,4,5 etc however when using the RANKX function I have noticed that if my values are the same for example 4 values are 25 then the ranking would be for example 1 for all 4 of those values. But I would want them to be 1,2,3,4 etc.
I have used this DAX measure:
The values are commonly going to be the same for multiple "short descriptions" I am not bothered about the order of the ranking if they are the same. Just making sure the rank rating is in order from 1-15.
Any thoughts?
Thanks
If it is possible in your case to do the Aggregation in Power Query part, you can create your row_number/index there as well. If I guess correct, your value in column Fifth Value is measure and you are doing aggregation with a group by applied on value Short Description. So you are getting Sort Description wise Fifth Value and you need a row number based on values for Fifth Value, right?
If the above is correct, you have to do the Sort Description wise aggregation in Power Query and add the Index there for your filtering purpose in the report.
I would like to create a calculated column or measure that shows the time elapsed in any given month. Preferably as a percentage.
I need to be able to compare productivity (rolling total) over a month's period between different months.So creating a percentage of time passed in a month would put every month on a level playing field.
Is there a way to do this?
Or is there a better way to compare productivity between 2 months on a rolling basis?
EDIT
I am graphing sales on a cumulative basis. Here is a picture of my graph to demonstrate.[][
Ideally I would like to be able to graph another person's sales on the same graph for a different month to compare.
The problem is each month is different and I don't think power bi allows much customization of the axes.
So I figured a potential solution would be to convert months to percentages of time passed, create two separate graphs and place them on top of each other to show the comparison of sales.
Using percentages doesn't sound right here: one person's "productivity" in February will appear lower than another person's productivity in March just because February has 3 less days.
Just use [Date].[Day].
To answer the original question (even though it shouldn't be used for this), month progress percentage calculated column:
MonthProgress% =
var DaysinMonth = DAY(
IF(
MONTH(MyTable[date]) = 12,
DATE(YEAR(MyTable[date]) + 1,1,1),
DATE(YEAR(MyTable[date]), MONTH(MyTable[date]) + 1, 1)
) - 1
)
return MyTable[date].[Day]/DaysinMonth*100
Also check DAX functions PARALLELPERIOD and DATEADD.
This is the solution I settled on.
I customized the ranges for the x and y axes so they match.
For the y-axis, I simply put the range from 0 to 50+ our highest month.
For the x-axis, I created a column with the DAY function so I got a number assigned to each day of the month which allowed me to manually set the chart range from 0 to 31. I have asked another question on how to only get workdays.
I'm working with google sheet and seeking some help.
Below is the situation and expected outcome.
- there is Income column, Payment column, Currency column, Balance column
Income and payment is where numbers are put
USD, JPY, THB, SGD in dropdown for currency
wrote below to detect which currency is selected
=IF(H7="THB",G7*, IF(H7="USD",G7*, IF(H7 = "JPY",G7)))
(above calculation is not done in any of the 4 columns mentioned above)
Balance column is using below calculation
=IF(AND(F7="",G7=""),"",I6+F7-G7)
1: Input number of income / payment
2: Currency selected
3: calculate the currency rate
4: reflect the result in THB and perform the existing calculation on balance column
Could anyone please teach me how to do this.
Essentially, I would like to use the result of calculation performed based of pulldown result to perform another calculation.
In other words, in php or any language, I want to assign the calculation result to a valuable then use that valuable in different argument.
Thanks !
I believe that in your balance column you could do what you want by joining the 2 formulas you have above or by using a helper column. The only thing I do not see in your formulas is the currency rates that you want to assign to each currency. Where are you getting the rates from?
So in a combined formula you would place the following formula:
=IF(H7="THB",I6+F7-G7, IF(H7="USD",(I6+F7-G7)*usdrate, IF(H7 = "JPY",(I6+F7-G7)*jpyrate)))
You just need to change usdrate and jpyrate with the actual exchange rates for those currencies.
Hope it helps.