Forum Discussion
Multi query sum showing only today's date
Hey All;
Curious how I can do this? I have the multi query sum down...
Hi Gumberculeez ,
than try this.
SELECT *, CAST(DispatchDate as Date) AS DispatchDate_New FROM _custom_eviews.RTPowerBI (NOLOCK)If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
25 Replies
- mwegener
Most Valuable Professional
Hi Gumberculeez ,
maybe you could post more information about your model.
Do you use a date table?
If I answer you question, please mark my post as solution, this will also help others.
Please give Kudos for support.
- Gumberculeez
Helper II
I'm using an SQL direct query.
Each query I'm bringing in has a date field. However, either will impact the measure.
- mwegener
Most Valuable Professional
Hi Gumberculeez ,
create a date table
Date = ADDCOLUMNS ( CALENDARAUTO( ); "Year"; YEAR ( [Date] ); "Month Name"; FORMAT ( [Date]; "mmmm" ); "Month Number"; MONTH ( [Date] ); "Weekday"; FORMAT ( [Date]; "dddd" ); "Weekday number"; WEEKDAY( [Date] ); "Quarter"; "Q" & TRUNC ( ( MONTH ( [Date] ) - 1 ) / 3 ) + 1; "Day of Month"; Day([Date]) )add the relationship to the date table
Mileage plus Mileage = CALCULATE( SUM('SCInvLabor'[Mileage]) + SUM('SCOpenLabor'[Mileage]); 'Date'[Date] = TODAY())If I answer you question, please mark my post as solution, this will also help others.
Please give Kudos for support.
- v-lili6-msft
Community Support
hi Gumberculeez
You could just adjust the formula as below:
Mileage plus Mileage = CALCULATE ( SUM ( 'SCInvLabor'[Mileage] ), 'SCInvLabor'[Date] = TODAY () ) + CALCULATE ( SUM ( 'SCOpenLabor'[Mileage] ), 'SCOpenLabor'[Date] = TODAY () )and you could also use mwegener's way that add a date table and then create the relatinship with fact table and just filter as 'Date'[Date] = TODAY()
Regards,
Lin
- Gumberculeez
Helper II
interesting.... I'm not getting any errors now with both solutions... however the formula itself is not working it seems...
It's "refresfing" however, it just maintains (BLANK) even though displaying each of those seperately provide numbers.
Could it have something to do with this being direct query information?
- mwegener
Most Valuable Professional
Hi,
maybe you could share a screenshot of your model, with the relations.