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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Calculating Revenues of sales whith the same value of a column of TODAY()

Hey everyone, 

 

I am pretty newbie in PBI and there's something I know possible but having technical issues performing. 

 

I have two tables: 

 

1: Sales (sales amounts , sales info, full date - Wednesday, February 1, 2017 for example)

 

2: Date Table ( full date, year, month,.....,FY - which starts at October and I create using simple M formula,...etc)

 

two tables are connected through the Full Date Column

 

I am currently trying to create a Fiscal Year To Date measure which is dynamic in time using the Today() Function.

My thinking was summing all of the sales amounts having the same FY as Today( ) function has... however nothing really works for me.

 

I tried:     Calculate( Sum('Sales'[Sales Amount]), Filter( All('Date Table'),'Date Table'[FY]=Today( )))

 

I know this is an error but how do I get to filter all of the rows who has FY value equal to Today ( ) FY value? 

 

Pretty lost here...

 

Thank you all in advance 🙂

 

5 REPLIES 5
v-danhe-msft
Employee
Employee

Hi @Anonymous ,

Could you please post some simple sample data and your desired result to have a test if possible? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Daniel He

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

I have 2 tables: Date Dim Table and Sales Fact Table ( I have more but they are irrelevant as for this questions) : 
Date Dim Sample:

DateYearQuarterOfYearMonthOfYearDayOfMonthWeekEndingWeek NumberQuarternYearShortYearFYFY QuarterShortMonthName
Saturday, July 1, 20172017371Saturday, July 1, 2017262017030017FY171Jul 
Sunday, July 2, 20172017372Saturday, July 8, 2017272017030017FY171Jul 

 

Sales FactT Sample:

MonthCategoryBrandSub BrandBarcode (EA)IndustrySub IndustryTotal Sales (K)Month-Year as Date
AugCat1PampersX4545454th Chain4ch 22222Wednesday, August 1, 2018
AugCat2PampersY4646464th Chain4ch 33333Wednesday, August 1, 2018

 


We calculate FY differently, although there's a destined function I want to be able to sum/avg all the sales having the same FY value as today as Today( ) - for the example let's Today( ) would give "Sunday, July 2, 2017" 
which FY value is "FY17":  so basically I want to create a measure which will track and sum all of the sales in FY17 (I already though of the possibility which the measure/calc column will also take in count future sales beyond today and made it so the Date Dim table will filter all of the rows beyond today so such possibility is prevented).

 

In general I don't know how to filter rows of a table based on a specific row's column value (e.g FY17 but could have been any other column..).

 

I hope this explanation in enough informative. 

 

Thanks again in advance 🙂 

 

 

 

Anonymous
Not applicable

@Anonymous - 

If I understand correctly, you need to do something like the following:

 

 

Yearly Sales = CALCULATE(           //Changes filters
	SUM('Sales'[SalesAmount]),  //Your Calculation
	ALL('Date'),                //Includes all of the Date table
        VALUES('Date'[Year])        //Includes only the year(s) associated with the "cell" being populated
)

 

Anonymous
Not applicable

Thanks for replying, however where is the reference to the FY17? 

 

lets say today( ) function gives us a row such as below: 

 

DateYearQuarterOfYearMonthOfYearDayOfMonthWeekEndingWeek NumberQuarternYearShortYearFYFY QuarterShortMonthName
Saturday, July 1, 20172017371Saturday, July 1, 2017262017030017FY17 1Jul

 

 

    

 

 

      

I would like that Power BI look at the FY Value of today (for this specific example it is FY17) and sum all of the sales in the Sales Fact Table (each row represents a different sale as presented in the example at the original post) with a date that have also FY17 under the FY column.. ( Sum all revenues which FY = Today( ) .FY which doesn't exist in DAX from what I've seen so far).

 

 

Thanks again 

Anonymous
Not applicable

@Anonymous - 

In the example I provided, you'll need to substitute the following with your values.

Specifically:

'Sales' -> Name of Fact table

[SalesAmount] -> Name of Fact table column

'Date' -> Name of Date table

[Year] -> Name of Date table column. This will be [FY]

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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