Forum Discussion
SelectedValue function not Working
- 2 years ago
sujit_Shirke
Please find the file attached.
https://drive.google.com/file/d/1dEKygfkYa-omPEodTfcsuu1Agj0mW9Rw/view?usp=share_linkIf the post helps please give a thumbs up
If it solves your issue, please accept it as the solution to help the other members find it more quickly.
Tharun
sujit_Shirke
In your file you created a caculated table, A calcualted table is static and it cannot capture the seclections made in the slicer even if you use selectedvalue function. Incase if you want to count the number of customers according to the selections in the slicer then create a measure and use countrows function.
Customers Not Ordering in Last X Days =
VAR XDays = SELECTEDVALUE(Days[XDays], 30) // Default to 30 if no value is selected
VAR PeriodStart = TODAY() - XDays
VAR CustomersWithOrders = CALCULATETABLE(
DISTINCT(Sales[Customer]),
Sales[InvoiceDate] >= PeriodStart // Changed the equality sign to greater than or equal to
)
VAR PreviousDays = PeriodStart - XDays
VAR AllCustomers = CALCULATETABLE(
DISTINCT(Sales[Customer]),
Sales[InvoiceDate] < PeriodStart,
Sales[InvoiceDate] >= PreviousDays // Changed the equality sign to less than
)
VAR CustomersNotOrdering = EXCEPT(AllCustomers, CustomersWithOrders)
RETURN
countrows( CustomersNotOrdering)
Or if you want to see the customer list according to then one of the patter that you can use is:
Customers Not Ordering in Last X Days =
VAR XDays = SELECTEDVALUE(Xday[Xday], 30) // Default to 30 if no value is selected
VAR PeriodStart = TODAY() - XDays
VAR CustomersWithOrders = CALCULATETABLE(
DISTINCT(Sales[Customer]),
Sales[InvoiceDate] >= PeriodStart // Changed the equality sign to greater than or equal to
)
VAR PreviousDays = PeriodStart - XDays
VAR AllCustomers = CALCULATETABLE(
DISTINCT(Sales[Customer]),
Sales[InvoiceDate] < PeriodStart,
Sales[InvoiceDate] >= PreviousDays // Changed the equality sign to less than
)
VAR CustomersNotOrdering = EXCEPT(AllCustomers, CustomersWithOrders)
RETURN
IF(SELECTEDVALUE(Sales[Customer] ) in CustomersNotOrdering, 1, 0) and put filters to remove 0.
If the post helps please give a thumbs up
If it solves your issue, please accept it as the solution to help the other members find it more quickly.
Tharun
- sujit_Shirke2 years agoNew Member
no luck
- tharunkumarRTK2 years agoSuper User
sujit_Shirke
Please find the file attached.
https://drive.google.com/file/d/1dEKygfkYa-omPEodTfcsuu1Agj0mW9Rw/view?usp=share_linkIf the post helps please give a thumbs up
If it solves your issue, please accept it as the solution to help the other members find it more quickly.
Tharun