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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
QwkInsightsTech
New Member

YTD without a date field specified

Hi All,

 

I am experimenting with DAX and SSAS Tabular and I have an issue which I can't seem to solve. Imagine the following data:

 

Order NoTransaction DateDelivery DatePrice
101/01/202005/01/2020100
203/01/202005/01/2020150
303/01/202006/01/2020200

 

To model the above I created 2 role playing date tables, one for the transaction date and one for the delivery date and I connected both of these tables to the sales fact.

 

To show the YTD values, I created 2 measures as follows:

YTD Sales by Tran Date:= CALCULATE(SUM('Sales'[Price]) ,DATESYTD('Transaction Date'[Date]))

and

YTS Sales by Delivery Date:= CALCULATE(SUM('Sales'[Price]) ,DATESYTD('Delivery Date'[Date]))

 

However ideally I would have 1 measure for YTD sales. Is there a way I can create a single measure named YTD sales and the value is calculated according to which date the user selects? From what I read so far it seems that the time functions all need a date specified to work.

 

Thanks

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @QwkInsightsTech 

You could create another measure that calls on one the measures you already have depending on the user selection. If you have slicers on those two date tables, you can check which one has been selected by the user, with ISFILTERED( ) for instance and decide what measure to invoke accordingly.

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

View solution in original post

1 REPLY 1
AlB
Community Champion
Community Champion

Hi @QwkInsightsTech 

You could create another measure that calls on one the measures you already have depending on the user selection. If you have slicers on those two date tables, you can check which one has been selected by the user, with ISFILTERED( ) for instance and decide what measure to invoke accordingly.

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

Helpful resources

Announcements