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.
Hi All,
I have a requirement to create a slicer based on Booking %. Given below are the tables used and the expected report output.
My report should show the dates without any bookings as well (checked show items with no data option for this).
Now I need to create a slicer which shows Booking% as 0% when no hours are booked in the fact table on a particular date. Since slicers does not accept measures, I need to crete a calculated column for booking% which should filter the dates which does not have any data in fact table on selecting 0% in the slicer. Does anyone have any idea on how to achieve this?
Tables Used:
Expected Report Output:
Thanks in Advance
Solved! Go to Solution.
Hi @PBIUser007 ,
Here are the steps you can follow:
Modify the data of the Date Table to look like this:
1. Click Transform data to enter power query, click merge queries as new, and leave Date Table and Resource Table as Left Outer.
Result:
2. Perform Left Outer on Merge1 Table and Bookings Table
Result:
3. Create calculated column.
Book% = 'Merge2'[BookingsTable.Hours Booked]/8
4. Select Book% in Merge2 as the slicer
5. Result:
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
This is an optimized and newly written method
Here are the steps you can follow:
1. Create a calculated table,
Table =
GENERATEALL(
'Resource Table','Date Table')
result:
2. Create a calculated table.
Table 2 =
GENERATEALL(
'Table',
var _tableid='Table'[Resource ID]
var _tabledate='Table'[date]
return
SELECTCOLUMNS(
CALCULATETABLE('BookingsTable','BookingsTable'[Resource ID]=_tableid&&'BookingsTable'[Date]=_tabledate),
"Hours Booked",'BookingsTable'[Hours Booked]))
3. Create a calculated column.
Book% = 'Table 2'[Hours Booked]/8
4. Use The Book% of Table2 as a cutter
5. Result.
You can download the PBIX file from here.
Best regards
Liu Yang
If this post helps, consider Accepting it as the solution to help other members find it faster.
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 |
---|---|
110 | |
99 | |
80 | |
64 | |
57 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |