dax

Top N Customer Names as a slicer in power BI

柔情痞子 提交于 2019-12-10 22:46:52
问题 i am new to power BI, i have a requirement to create a report which will show the data for top N customer based on sales amount. once i have identify the top N customer i need other charts / table / graphs to show the data of these N customer. so eventually i need a slicer that will show me the top N customer based on sales. i have gone through various post, there they dynamic way of finding the top N (disconnected table) and then customer name as a measure is possible. when i combine this

PowerBI Natural Left outer join issues with deleted rows in right table

夙愿已清 提交于 2019-12-10 19:26:30
问题 I have two tables. 1) Table 1 : 1 column with date value 2) Table 2 : 2 columns : Date column + business value column I am trying to use DAX in PowerBI to create a new table using a left outer join to fill missing dates in my second table. First table : | Date | | 2015-05-01 | | 2015-06-01 | | 2015-07-01 | | 2015-08-01 | Second table : | Date | Value | | -----------|--------- | | 2015-05-01 | 5 | | 2015-05-01 | 5 | | 2015-06-01 | 6 | | 2015-07-01 | 7 | DAX code to create new table : Table =

Power BI, DAX--How do I count rows in one table based on values in another table?

只愿长相守 提交于 2019-12-10 17:48:30
问题 I have two tables, lets call them Table1 and Table2. Table1 has a column of unique values, Table2 has a column with the same values but repeated. What I am trying to accomplish is to calculate the number of times that value appears in Table2 as a new column in Table1. 回答1: If the tables are related, this is very simple: Number of Table2 rows = COUNTROWS(RELATEDTABLE(Table2)) Here is an example: Your Table2 contains multiple rows per Table1 key: Then you can add a Calculated Column to Table1

Traffic lights in Power Bi which work also for totals

这一生的挚爱 提交于 2019-12-10 16:47:34
问题 How to make traffic light in table visual which works also for totals? Let's say our KPI is some sort of a ratio or a share like GDP per capita by countries , or the difference from the budget by stores . It is interesting to have traffic lights for individual categories but it would be even more interesting to have a traffic light for summary of all categories. I followed and example shown here: The idea is based on adding a DAX measure: TrafficLight = UNICHAR(11044) And then we set up

Aggregated sum in DAX

本小妞迷上赌 提交于 2019-12-10 11:59:51
问题 I'm leasing a car, which I use my self, but also rent out for other people to use. I have 2000km I can drive each month, so I'm trying to do an area pivot graph which will track how much I use it vs how much it's rented out. I have a table column consisting of the rented mileage and my own mileage ___________________________________ |Date |Rented mileage|Own mileage| |23/03-18| 315| 117| |07-04-18| 255| 888| |07/04-18| 349| 0| |13/04-18| 114| 0| |21/04-18| 246| 113| |28/04-18| 1253| 0| |01/05

SUM IF in Power BI

≯℡__Kan透↙ 提交于 2019-12-10 10:06:23
问题 Is it possible to SUM on conditions in Power BI? I have a column that contains the values UK and Italy alongside other columns: employee and hours spent. I want to make a measure to show total hours spent by an employee in Italy and another to show total hours spent by an employee in UK. I am having no luck with the DAX language. Can anyone help? 回答1: Yes. There are two basic approaches to this. CALCULATE(SUM(TableName[Hours]), TableName[Country] = "Italy") or SUMX(FILTER(TableName, TableName

How to select a nonblank date

丶灬走出姿态 提交于 2019-12-08 11:44:25
问题 In power BI, I am computing the percentage difference between Stock price index levels over the last year. Ann pch = VAR __EarliestValue = CALCULATE(SUM('Equity Markets (2)'[Value]), DATEADD(LASTDATE('Calendar'[Date]),-1,YEAR)) VAR __LastDateValue = CALCULATE(SUM('Equity Markets (2)'[Value]), LASTDATE('Calendar'[Date])) RETURN CALCULATE( DIVIDE(__LastDateValue,__EarliestValue) -1) The above is correct but there is a bug: some dates fall on the weekend, or other non-trading days, in which case

Create DAX to count number of occupied rooms per calendar date in Power BI

笑着哭i 提交于 2019-12-08 11:38:57
问题 I am trying to count the number of "Occupied rooms" per calendar date. so if there was say 6 reserves with diffrent "DateIN" and "DateOUT" I would be able to calculate how many rooms occupied there was every day. I have done this by using a column formula - but I need it to be a measure in order to be filtered by slicers. Here is a simple example of what I would need: BOOKINGID DateIN DateOUT 000001 01-01-2017 06-01-2017 000002 01-01-2017 03-01-2017 000003 02-01-2017 03-01-2017 000004 03-01

How to SUM a Column based on another column in DAX Powerpivot

亡梦爱人 提交于 2019-12-08 08:34:38
问题 Here is the example, +------+----+ | CARS | 3 | | CARS | 4 | | CARS | 6 | | CARS | 76 | | CARS | 4 | | CARS | 3 | | SUV | 32 | | SUV | 3 | | SUV | 3 | | SUV | 2 | | SUV | 3 | | SUV | 5 | +------+----+ I want to add a new calculated column with data like this +------+----+------+ | CARS | 3 | 96 | | CARS | 4 | 96 | | CARS | 6 | 96 | | CARS | 76 | 96 | | CARS | 4 | 96 | | CARS | 3 | 96 | | SUV | 32 | 48 | | SUV | 3 | 48 | | SUV | 3 | 48 | | SUV | 2 | 48 | | SUV | 3 | 48 | | SUV | 5 | 48 | +----

Custom x-axis values in Power BI

喜欢而已 提交于 2019-12-08 06:14:47
问题 I want to plot a graph over a year+weeknumber on the x axis. Each data-point contains this specific value; for example week 7 of 2016 is expressed as 201607 etc. and called YearWeek I created a date table in which I calculate all possible YearWeek value in a certain date-range. Then I created a YearWeek table extracting all distinct YearWeeks. This I connected to the Fact-Table. What I want to chart is exactly according to this matrix: Note that I explicitly selected to show items with no