Forum Discussion
Hour Calculation
Hello,
How to display Flag_Hrs to 1 if Flag_Hrs greater then 1 or 0 if lesser then 10
and 1 & 0 should display in slicer.
PBIX Link: PBIX Link
Regards,
Chandrashekar B
Hi Chandrashekar for that create one more measure using below dax
Flag_Hrs_Display =IF([Hours] > 10,1,0)
If this answers your questions, kindly accept it as a solution and give kudos.
7 Replies
- mdaatifraza5556Super User
Hi Chandrashekar
I am assuming that Hours ( you are showing is a measure).
Then first Create a disconnected table (Go to Modeling -->New Table (using DAX) )
Flag_Slicer =
DATATABLE(
"Flag_Hrs", INTEGER,
{
{0},
{1}
}
)
and use this in the slicer.
Now create the second measure which will work when you select the slicer it will show (if 1 selected then only above 10 hours rows, and if 0 selected then it will show below 10 hours rows)Flag_Filter =
VAR SelectedFlag =
SELECTEDVALUE(Flag_Slicer[Flag_Hrs], -1)RETURN
SWITCH(
TRUE(),
SelectedFlag = 1 && [Hours] > 10, 1,
SelectedFlag = 0 && [Hours] <= 10, 1,
SelectedFlag = -1, 1, -- Nothing selected
0
)Then select the visual and apply visual level filter.
AFter selecting the visual got to filter pane and drag Flag_Filter measure and set it to 1
If this answers your questions, kindly accept it as a solution and give kudos.- mdaatifraza5556Super User
Hi Chandrashekar
Also find the PBIX file to understnad how it is working.If this answers your questions, kindly accept it as a solution and give kudos.
- ChandrashekarResolver III
Hello,
When I drag Flag_slicer in table it shows 1 but based on condition it should 0 & 1 if conditon mets.
Condtion:
If Slicer selection 1 then Flag_hours should display hours lesser then 10 hours
If slicer selection 0 then Flag_hours should display hours greater then 10 hours
Regards,
Chandrashekar B
- Hans-Georg_PulsSuper User
Hi Chandrashekar ,
I must admit that I don't quite understand your requirements.
- Flag_hrs should be 1 if the value in the "Hours" column is ??? (What is the exact condition?)
- Flag_hrs should be 0 if the value in the "Hours" column is ??? (What is the exact condition?)
- Is it right that you want a slicer to filter your table by Flag_hrs?
- ChandrashekarResolver III
Hello,
If Slicer selection 1 then Flag_hours should display hours lesser then 10 hours
If slicer selection 0 then Flag_hours should display hours greater then 10 hours
Regards,
Chandrashekar B