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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
razvancanuta
Frequent Visitor

Cannot create calculate table in SSAS like I do in PowerBI

Hello,
I have an issue when I try to create the same calculate table in SSAS as in PowerBI desktop

The table looks like this:
=SUMMARIZECOLUMNS(
   Fact[Date],
   Fact[CountryID],
   Fact[ProductId],
   "Tickets", SUM( Fact[Tickets] ),
   "Tickets in Period",
     CALCULATE(
         SUM( Fact[Tickets] ),
         DATESINPERIOD( Fact[Date], SELECTEDVALUE( Fact[Date] ), -71, DAY ),
         Fact[Date] < SELECTEDVALUE( Fact[Date] ) 
     )

The issue appear when I add the second filter clause, because I dont want the current day included in the calculation.
The Visual Studio where I created the Tabular model does not provide a text error, it just simply says "One or more formulas have errors."

Again, the formula in Pbi Desktop works just fine and as expected, the issue is in Visual Studio, SSAS Model.

If you guys can help me on this issue I would really appreciate it!

Thanks!


2 REPLIES 2
amitchandak
Super User
Super User

@razvancanuta , try max in place of SELECTEDVALUE

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi,

Its giving me the same response "One or more formulas have errors", but only when I add the second filter option, even if I add the second one alone.

Initially I had one more condition,  WEEKDAY( Facty[Date] )=WEEKDAY( MAX(Fact[Date]) ), but it gives me the same error.
Seems like he likes only the DATESINPERIOD formula.

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

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