Forum Discussion
User Input is not recognized in DAX formula
Hi Anonymous ,
Try to test the below:
Step1,create silcer table for per:
Then use the below:
test1 = SWITCH ( TRUE (),
(SELECTEDVALUE('Table'[source])= "VW1"&& SELECTEDVALUE('Table'[PER])<= SELECTEDVALUE(preslicer[preslicer])), [measure1],
( SELECTEDVALUE('Table'[Source])= "VW2"&&SELECTEDVALUE('Table'[PER]) = SELECTEDVALUE(preslicer[preslicer])) , [Measure2] , 0 )
return:(return value according measure1 ,and measure)
You could download my pbix file if you need.
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi Lucien,
Thank you for trying to help. I downloaded your file, simplified it to clarify what the expected results should be but the numbers in the resulting table don't reflect what I was looking for. Maybe I am missing something here so if you can review this with me. If we focus on just VW1 and VW2 to make it simple, here is the data from your test table:
| Source | PER | Value |
| VW1 | 1 | 3 |
| VW1 | 2 | 64 |
| VW1 | 2 | 1 |
| VW2 | 2 | 3 |
| VW2 | 3 | 21 |
| VW2 | 4 | 31 |
| VW2 | 5 | 3 |
Further, if we can remove the PER and Source slicers, leaving only preslicer and the table in your dashboard. If a user select 1 in the preslicer, we would need to see the following values for VW1 and VW2:
For VW1, we want all periods less than or equal to the selected period, in this case 1. For VW2, we only want period selected, 1. So VW1 should have the value of 3 and VW2 should have 0.
When the preslicer is 2, VW1 should be (3 + 64 + 1) = 68. VW2 should be 3.
When the preslicer is 3, VW1 should still be 68 since there is no period 3. VW2 should be 21.
When the preslicer is 4, VW1 should still be 68 since there is no period 3 or 4. VW2 should be 31.
When the preslicer is 5, VW1 should still be 68 since there are no period 3 through 5. VW2 should be 3.
I did modify the formular test1 but could not get the numbers that I am looking for.
Thank you so much for your interest.
Daniel