Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Gumberculeez
Helper II
Helper II

Multi query sum showing only today's date

Hey All;

 

Curious how I can do this?  I have the multi query sum down...

 

Mileage plus Mileage =
SUM('SCInvLabor'[Mileage]) + SUM('SCOpenLabor'[Mileage])  
 
however, I'd like to add a filter to show just the above just for today.
 
an assist would be fantastic! 🙂
 

 

 

1 ACCEPTED SOLUTION

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.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

25 REPLIES 25
v-lili6-msft
Community Support
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

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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?

Hi,
maybe you could share a screenshot of your model, with the relations.
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


for sure... and thanks for the continued assist.  this is new territory for me 🙂

Mileage relation1.pngMileage relation2.png

Looks good.

Are new data in the table?

Have filters been set?

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


there is ya...  and filters are on.  

 

This pic shows the 2 queries with the measure we are working toward on top...

Mileage relation3.png

Could this be the issue guys?  Seems the dispatchtime is pulling over a time stamp as well.... is it messing with the Today value?

 

Mileage relation4.png

SQL:

SELECT
CAST(DispatchDate as Date) AS DispatchDate
....
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Yes, i think so.
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


How, you create the queries?
Power Query or SQL?
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


I'm doing a direct query from the SQL database in PowerBI.

Hi @Gumberculeez ,

 

with SQL you can use a CASE, to convert a datetime to date

CAST(DispatchDate as Date) AS DispatchDate

 

with Power Query you can change the datatype from datetime to date

 

If I answer you question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Just to confirm, I'm required to do this in SQL Studio or PowerBI?

 

I'm direct query'ing data directly from our business system's SQL database.  So I not altering that.... lol

Hi @Gumberculeez 

 

at Power BI.

Could you share a screenshot from your query?

 

If I answer you question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


this is the current statement I use...

 

Mileage relation5.png

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.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


It's alive! 😄 

 

fully working now.  thanks so much for the assist.

Hey @Gumberculeez ,

 

you are welcome!

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


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.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


I'm using an SQL direct query.  

 

Each query I'm bringing in has a date field.  However, either will impact the measure.  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.