Forum Discussion
ylebec
7 years agoRegular Visitor
Table relationship with aggregated data and time slider visual
Hi, I have a table with the scheduled services to be operated depending by day type (Weekday, Saturday, Sunday) Then another tablewith thte actual services operated over the first 5 ...
- 7 years ago
Add a calculated column and use two measures.
Type = SWITCH ( WEEKDAY ( Table2[Date] ), 1, "Sunday", 7, "Saturday", "Weekday" )
Measure = SUMX ( VALUES ( Table2[Type] ), CALCULATE ( COUNTROWS ( FILTER ( Table1, Table1[Day of Operation] = SELECTEDVALUE ( Table2[Type] ) ) ) * DISTINCTCOUNT ( Table2[Date] ) ) )Measure 2 = COUNTROWS ( Table2 )
v-chuncz-msft
Community Support
7 years ago
Add a calculated column and use two measures.
Type = SWITCH ( WEEKDAY ( Table2[Date] ), 1, "Sunday", 7, "Saturday", "Weekday" )
Measure =
SUMX (
VALUES ( Table2[Type] ),
CALCULATE (
COUNTROWS (
FILTER ( Table1, Table1[Day of Operation] = SELECTEDVALUE ( Table2[Type] ) )
)
* DISTINCTCOUNT ( Table2[Date] )
)
)
Measure 2 = COUNTROWS ( Table2 )
ylebec
7 years agoRegular Visitor
Thank you for that!
One thing though, if I shorten the formula to the one below I get the same results. What's the DistinctCount function doing there?
COUNTROWS (
FILTER ( 'Data - Work Report', 'Data - Work Report'[Day Type] = SELECTEDVALUE ( Data[Day Type] ) )
)