Forum Discussion

asdf1608's avatar
asdf1608
Icon for Helper V rankHelper V
3 years ago
Solved

To select week, mtd, quarter based on parameter

I have created a parameter week, mtd,qtd, quarter. 

If week is selected that particular week's data should be shown.

For example if I have selected week the records of this week should be shown in table.

I have created calculated field for all the values in parameter.

Qtd = QUARTER('Table'[Joined]) = QUARTER(TODAY())
Quarter = DATEDIFF('Table'[Joined],TODAY(),QUARTER)=1
Week = DATEDIFF('Table'[Joined],TODAY(),DAY)<=7.
 
How do I get this as filter in power BI.
For example:

If week is selected onl this weeks value should be shown.

I have attached the pbi file:

Sample.pbix

How to do this in power Bi

 

Help in this is needed.

Thanks in advance

 

  • Display slicer is not connected in any way to the table visual. A measure is needed so that the value changes in the visual.

    Reference this DAX: 

    Switch ( selectedvalue(Dates[Display]) ,
    "Week", calculate(sum(Table[Salary]), filter(Table, 'Table'[Week]= TRUE())),
    "mtd", calculate(sum(Table[Salary]), filter(Table, 'Table'[Mtd]= TRUE())),
    "quarter", calculate(sum(Table[Salary]), filter(Table, 'Table'[Quarter]= TRUE())),
    "qtd", calculate(sum(Table[Salary]), filter(Table, 'Table'[Qtd]= TRUE()))
    )
    Make changes according to tables and convenience. 

2 Replies

  • Display slicer is not connected in any way to the table visual. A measure is needed so that the value changes in the visual.

    Reference this DAX: 

    Switch ( selectedvalue(Dates[Display]) ,
    "Week", calculate(sum(Table[Salary]), filter(Table, 'Table'[Week]= TRUE())),
    "mtd", calculate(sum(Table[Salary]), filter(Table, 'Table'[Mtd]= TRUE())),
    "quarter", calculate(sum(Table[Salary]), filter(Table, 'Table'[Quarter]= TRUE())),
    "qtd", calculate(sum(Table[Salary]), filter(Table, 'Table'[Qtd]= TRUE()))
    )
    Make changes according to tables and convenience.