Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am trying to design this chart in powerbi. The x axis contains different time limits.
Currently this is design in excel and the table below is the source of data
Average Tests | |
March | 2 |
April 1 - 28 | 4 |
April 29 - July 17 | 56 |
July 20 - Oct 9, 2020 | 63 |
Oct 12 2020-Nov 11, 2022 | 15 |
This table is created after getting average test from the same column on a different table below
Date | Number of Tests |
03/09/20 | 1 |
03/10/20 | 2 |
03/11/20 | 1 |
03/12/20 | 0 |
Currently powerbi has access to the primary dataset below
Date | Name| Race/Ethnicity | Result
My inital thought was using DAX ROW or DATATABLE to create a Virtual or static table and use the average function to get the numbers. I am stuck!!! I will honestly appreciate any help provided.
Solved! Go to Solution.
hi @fnyameino
If your categorization is static, the easiest way would be to add a category column in your record table. Then you could pull the category column to your plotting x-axis.
the code to add the column looks like this:
Category =
SWICH(
TRUE(),
"March", TableName[Date]<=DATE(2020,3,31),
"April 1- 28", TableName[Date]<=DATE(2020,4,28),
"April 29- July 17", TableName[Date]<=DATE(2020,7,17),
"July 20- Oct 9 2020", TableName[Date]>=DATE(2020,7,20)&&TableName[Date]<=DATE(2020,10,9),
"Oct 12 2020- Nov 11, 2022", TableName[Date]>=DATE(2020,10,12)&&TableName[Date]<=DATE(2022,11,11)
)
if you have a dynamic grouping, say the way of categorization changes periodically and you find the change in DAX code is an issue, you may import the category table into Power BI and related with the record table.
hi @fnyameino
If your categorization is static, the easiest way would be to add a category column in your record table. Then you could pull the category column to your plotting x-axis.
the code to add the column looks like this:
Category =
SWICH(
TRUE(),
"March", TableName[Date]<=DATE(2020,3,31),
"April 1- 28", TableName[Date]<=DATE(2020,4,28),
"April 29- July 17", TableName[Date]<=DATE(2020,7,17),
"July 20- Oct 9 2020", TableName[Date]>=DATE(2020,7,20)&&TableName[Date]<=DATE(2020,10,9),
"Oct 12 2020- Nov 11, 2022", TableName[Date]>=DATE(2020,10,12)&&TableName[Date]<=DATE(2022,11,11)
)
if you have a dynamic grouping, say the way of categorization changes periodically and you find the change in DAX code is an issue, you may import the category table into Power BI and related with the record table.
This worked the magic
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |