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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Nanakwame
Helper II
Helper II

Calculation to Compare Today() and Previous Day

Hi Power BI Experts,

 

I am looking to calculate "Current Position" for today and yesterday. 

Formula for current position = Opening Balance + Debits + Debits (shown as a negative value) + Outstanding Checks (Shown as a negative Value)

 

So far i have the measures below and i get an error/blank value. 

Yesterday's Current Position = CALCULATE([sum of Current Position], FILTER('Date', 'Date'[Date] = TODAY()))
Today's Current Position = CALCULATE([Current Position], dailyKPI[Today])
 
I used the date table and also the date from the fact table and both didnt work. 
1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Nanakwame ,

According to your description, I create a sample, is this your expected outcome?

vkalyjmsft_0-1637549664896.png

vkalyjmsft_1-1637549664903.png

 

 

In this formula, date in the filter can also be the fact table or calendar table, if you use the calendar table , the two tables should make relationship first.

Best Regards,
Community Support Team _ kalyj

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

View solution in original post

8 REPLIES 8
v-yanjiang-msft
Community Support
Community Support

Hi @Nanakwame ,

According to your description, I create a sample, is this your expected outcome?

vkalyjmsft_0-1637549664896.png

vkalyjmsft_1-1637549664903.png

 

 

In this formula, date in the filter can also be the fact table or calendar table, if you use the calendar table , the two tables should make relationship first.

Best Regards,
Community Support Team _ kalyj

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

Hi @v-yanjiang-msft 

 

I get an error for this function. Please see image below. "Sum of Current Position" is measure which is a sum of columns in the table.

 

Nanakwame_0-1637552875900.png

 

 

 

Maybe the sum of current positions needs to be a column instead?

Hi @v-yanjiang-msft 

 

I created it as a column and it worked however i dont thing the values for "sum of current position" as a column is right 

Hi @Nanakwame ,

If "Sum of Current Position" is a measure, you should remove MAX function, like this:

Today's Current Position = CALCULATE([Measure],FILTER(ALL('Calendar'),'Calendar'[Date]=TODAY()))
 
Best Regards,
Community Support Team_kalyj
Gabriel_Walkman
Continued Contributor
Continued Contributor

If you just use [sum of Current Position] in a visual, does it work?

What is the error you're getting?

The column named [Today] seems off. Have you made a calculated column just for displaying which rows are today? Scratch that, should work with the 'Date'[Date] = today() method, if your relationships from the calendar table are correct.

Hi @Gabriel_Walkman 

 

"sum of current position" is a measure that sums up a few columns in the table. 

Hi @Gabriel_Walkman 

 

It comes as "Blank"

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.