Forum Discussion
calculate and all
Hi all,
suppose I have three columns - date (total time frame of 15 days), product id and total units sold.
Also, suppose I want to see the following: Product, number of days in which product was actually sold and number of days in the time frame which is always 15 (I want to later calculate average sales of each product over the entire time frame).
How do I get the "always 15" column?
I tried a combination of calculate, distinctcount and all, but always got the two latter columns identical (for example: if product x was sold only in 12 out of 15 days, it shows 12 in both columns).
Thanks in advance,
Alex
5 Replies
- Greg_Deckler
Community Champion
You could always just use a VAR statement and set it equal to 15.
- Sasha
Helper III
I would like it to be dynamic, so when the model is refreshed for a different time frame, the measures will reflect the change.
- Thejeswar
Super User
Sasha wrote:I would like it to be dynamic, so when the model is refreshed for a different time frame, the measures will reflect the change.
What do you mean when you say, "The Model is refreshed for a different Time Frame"?
Do you mean you have a slicer where you will define the Time Frame...???
If that is the case, in the variable use the SELECTEDVALUE function. Some thing like the below DAX
VAR Timeframe = SELECTEDVALUE(Days) where Days is your slicer selected value. But here you will need to have Days as a column in your model