Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello Experts,
I have a Star Schema similar to mentioned here on the Microsoft page. I am trying to build a DAX query that has Role playing dimensions which acts as a filter as well in this case. However, these are the things I would like to achieve here:
Please let me know if you need any other information to help me.
Thanks!
There was some limitation with the number of characters in the original message. So, posting further information here:
EVALUATE SUMMARIZECOLUMNS( 'Dim_Product'[ProductCode], 'Dim_SalesTerritory'[TerritoryName], 'Dim_Date_Purchase'[FullDate], 'Dim_Date_Delivery'[FullDate], 'Dim_Reseller'[ResellerName], 'Dim_Time_Purchase'[FullTime], 'Dim_Time_Delivery'[FullTime], FILTER('Dim_Date_Purchase', 'Dim_Date_Purchase'[FullDate] >= DATE(2020, 01, 01) ), FILTER('Dim_Date_Delivery', 'Dim_Date_Delivery'[FullDate] <= DATE(2020, 01, 05) ), "Days of Transactions", 'Fact_Purchase_Transactions'[Days of Transactions] )
Here is what I am expecting as output:
'EZ09A', 'NW', '1/1/2020', '1/4/2020', 'Jumanji Steelers', '10:00', '14:00', '**345**'
'B9A34', 'SE', '1/2/2020', '1/5/2020', 'Jumanji Steelers', '06:30', '10:00', '***4***'
'Y57P0', 'SW', '1/3/2020', '1/5/2020', 'Jumanji Steelers', '10:30', '04:30', '****5**'
Example-2:
Here is what I tried so far:
EVALUATE SUMMARIZECOLUMNS( 'Dim_Product'[ProductCode], 'Dim_SalesTerritory'[TerritoryName], 'Dim_Date_Purchase'[FullDate], 'Dim_Date_Delivery'[FullDate], 'Dim_Reseller'[ResellerName], 'Dim_Time_Purchase'[FullTime], 'Dim_Time_Delivery'[FullTime], FILTER('Dim_Date_Purchase', 'Dim_Date_Purchase'[FullDate] >= DATE(2020, 01, 04) ), FILTER('Dim_Date_Delivery', 'Dim_Date_Delivery'[FullDate] <= DATE(2020, 01, 05) ), "Days of Transactions", 'Fact_Purchase_Transactions'[Days of Transactions] ) Here is what I am expecting as output:
'B9A34', 'SE', '1/4/2020', '1/5/2020', 'Jumanji Steelers', '06:30', '10:00', '***4***'
'Y57P0', 'SW', '1/4/2020', '1/5/2020', 'Jumanji Steelers', '10:30', '04:30', '****5**'
The first example can be written like this (I have not tried it out, though):
EVALUATE
// These two variables can get values from outside
// but how to do it depends on what's calling this
// query. If it's called from SSRS, for instance,
// I think you can pass values using
// @DateStart, @DateEnd like this:
// var __purchaseDateStart = @DateStart
// var __purchaseDateEnd = @DateEnd
// But the specific mechanism is dependent on the
// technology you use.
// By they way, why are you making the names of the
// tables so long and thus not easily readable? It's
// really more than enough to say 'Product' instead
// of Dim_Product. Same goes for all the other tables,
// especially the fact table monster.
var __purchaseDateStart = DATE ( 2020, 01, 01 )
var __purchaseDateEnd = DATE ( 2020, 01, 05 )
return
CALCULATETABLE(
SUMMARIZECOLUMNS (
'Dim_Product'[ProductCode],
'Dim_SalesTerritory'[TerritoryName],
'Dim_Date_Purchase'[FullDate],
'Dim_Date_Delivery'[FullDate],
'Dim_Reseller'[ResellerName],
'Dim_Time_Purchase'[FullTime],
'Dim_Time_Delivery'[FullTime],
"Days of Transactions",
var __daysOfTran =
VALUES( 'Fact_Purchase_Transactions'[Days of Transactions] )
var __valuesForString =
ADDCOLUMNS(
GENERATESERIES(1, 7),
"DisplayValue",
var __number = [Value]
if(
__number in __daysOfTran,
__number,
"*"
)
)
return
CONCATENATEX(
__valuesForString,
[DisplayValue],
"",
[Value],
ASC
)
),
'Dim_Date_Purchase'[FullDate] >= __purchaseDateStart,
'Dim_Date_Delivery'[FullDate] <= __purchaseDateEnd
)
The other one can be obtained similarly.
You might need to adjust GENERATESERIES(1, 7) but from what you've presented I gather that the numbers can be from 1 to 7.
Best
D
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 13 | |
| 12 | |
| 10 |