Forum Discussion

cst_dev32's avatar
cst_dev32
Frequent Visitor
7 years ago
Solved

Default Filtering by Year and Month Abbrev

Hi,   I'm have 2 situation here. 1st i'm trying to make some default filtering to PO Amount by Month Chart by Year_Number on slicer. The Year_Number is base on Dim_Date that was generate for 5 yea...
  • cst_dev32's avatar
    7 years ago

    Hy affan v-yuta-msft

     

    Thank's for reply to my question, but i figure it out by my self to solved this problem, FINALY after 5 Days!

     

    here what i do to my case:

     

    1st

     

    I create calculated measure to display the default Amount by Month of this year if the slicer not being selected.

    The slicer is filled by column named Dim_Date[Year_Number] 

    here's the formula:

     

     

    DefaultSelectionByMonth = 
    IF(COUNTROWS(DISTINCT(ALLSELECTED(Dim_Date[Year_Number]))) < COUNTROWS(DISTINCT(ALL(Dim_Date[Year_Number])));
    SUM([PO_Amount]);
    CALCULATE(SUM([PO_Amount]);FILTER(ALL(Dim_Date[Year_Number]);Dim_Date[Year_Number]=YEAR(TODAY()))))

    this exacly what i neet to showing my data to PO Amount by Month Chart

     

     

    2nd

     

    Just like the PO Amount by Month Chart, the PO Amount by Date Chart is used calculated measure too, but the condition is by the columns Dim_Date[Year_Number] and Dim_Date[Month_Abbrev]

     

    here's the formula:

     

    DefaultSelectionByDate = 
    IF(COUNTROWS(DISTINCT(ALLSELECTED(Dim_Date[Year_Number]))) < COUNTROWS(DISTINCT(ALL(Dim_Date[Year_Number])));
    IF(COUNTROWS(DISTINCT(ALLSELECTED(Dim_Date[Month_Abbrev]))) < COUNTROWS(DISTINCT(ALL(Dim_Date[Month_Abbrev])));
    SUM([PO_Amount]);
    CALCULATE(SUM([PO_Amount]);FILTER(ALL(Dim_Date[Month_Abbrev]);Dim_Date[Month_Abbrev]=FORMAT(TODAY();"MMM"))));
    IF(COUNTROWS(DISTINCT(ALLSELECTED(Dim_Date[Month_Abbrev]))) < COUNTROWS(DISTINCT(ALL(Dim_Date[Month_Abbrev])));
    CALCULATE(SUM([PO_Amount]);FILTER(ALL(Dim_Date[Year_Number]);Dim_Date[Year_Number]=YEAR(TODAY())));
    CALCULATE(SUM([PO_Amount]);FILTER(ALL(Dim_Date[Month_Abbrev]);Dim_Date[Month_Abbrev]=FORMAT(TODAY();"MMM"));FILTER(ALL(Dim_Date[Year_Number]);Dim_Date[Year_Number]=YEAR(TODAY())))))

    and this works!

     

    All the calculated measure is used as value on stack chart. It's Also can be used in any visual that you want to show the default value before some visual or slicer clicked.

    Maybe this can help others with the same issued.

     

    Thank You All...

     

    Best regards,

    Adrin Pratama