Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello everyone,
need your help with creating a table with totals like this:
I've created measures:
Solved! Go to Solution.
Hi @Delphia ,
Based on my test, you could create a new table for period type like this( The index column is used to sort)
Then use the following formula to create a measure:
Measure =
SWITCH (
MAX ( 'Period Type'[Period] ),
"Last Week",
CALCULATE (
SUM ( 'Table'[Value] ),
DATESINPERIOD ( 'Calendar'[Date], TODAY (), -7, DAY ),
FILTER ( 'Table', 'Table'[Occupation] = MAX ( 'Table'[Occupation] ) )
),
"Last 4 Weeks",
CALCULATE (
SUM ( 'Table'[Value] ),
DATESINPERIOD ( 'Calendar'[Date], TODAY (), -28, DAY ),
FILTER ( 'Table', 'Table'[Occupation] = MAX ( 'Table'[Occupation] ) )
)
)
The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Delphia ,
In my data sample, yes, creating a new table is not very necessary unless you want to filter data with slicer or some other conditions. But in this case, you need to create many measures.
Last Week = CALCULATE(SUM('Table'[Value]), DATESINPERIOD('Calendar'[Date],TODAY(),-7,DAY),FILTER('Table','Table'[Occupation]=MAX('Table'[Occupation])))
Last 4 Weeks = CALCULATE(SUM('Table'[Value]), DATESINPERIOD('Calendar'[Date],TODAY(),-28,DAY),FILTER('Table','Table'[Occupation]=MAX('Table'[Occupation])))
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Delphia ,
In my data sample, yes, creating a new table is not very necessary unless you want to filter data with slicer or some other conditions. But in this case, you need to create many measures.
Last Week = CALCULATE(SUM('Table'[Value]), DATESINPERIOD('Calendar'[Date],TODAY(),-7,DAY),FILTER('Table','Table'[Occupation]=MAX('Table'[Occupation])))
Last 4 Weeks = CALCULATE(SUM('Table'[Value]), DATESINPERIOD('Calendar'[Date],TODAY(),-28,DAY),FILTER('Table','Table'[Occupation]=MAX('Table'[Occupation])))
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much for your help!
Hi @Delphia ,
Based on my test, you could create a new table for period type like this( The index column is used to sort)
Then use the following formula to create a measure:
Measure =
SWITCH (
MAX ( 'Period Type'[Period] ),
"Last Week",
CALCULATE (
SUM ( 'Table'[Value] ),
DATESINPERIOD ( 'Calendar'[Date], TODAY (), -7, DAY ),
FILTER ( 'Table', 'Table'[Occupation] = MAX ( 'Table'[Occupation] ) )
),
"Last 4 Weeks",
CALCULATE (
SUM ( 'Table'[Value] ),
DATESINPERIOD ( 'Calendar'[Date], TODAY (), -28, DAY ),
FILTER ( 'Table', 'Table'[Occupation] = MAX ( 'Table'[Occupation] ) )
)
)
The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for your help. It works with table. Nevertheless, I don't have a separate table with these values. I use measures in my calculations:
For example:
@Delphia
When you use a matrix visual, you have one option "Show on Rows" under Values section, you can turn it on and place the category in the columns to get the desired layout.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thank you so much for your advice! But how can I make that in rows it will be description of value (hours, $, margin, etc) and on the columns time period (last month, last 4 months, last year, YTD, etc.)? Should I create another type of values? Or it should be another table (summerized?)?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |