Forum Discussion

saivina2920's avatar
saivina2920
Post Prodigy
5 years ago
Solved

Problem while comparing the date in different periods for pie chart

I am creating different measure like (<10 days, 10 to 20 Days and >20 Days).

 

While applying the meaasure in pie chart values, i am getting erroras mentioned below.

 

sample test .PBIX file attached.

 

 

https://1drv.ms/u/s!AiSRcgO5FUmN8SEmIwIM57N3eobB?e=JC5V2l 

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi saivina2920 ,

    As checked your sample pbix file, there are some syntax error in measure [10to20Days] and [LessThan10Days]. Please update them with the below formulas and check whether it can get the correct result:

    Note: The part in red font is newly added.

    10to20Days =
    CALCULATE (
        DISTINCTCOUNT ( EMP_TABLE[EMP_NO] ),
        FILTER (
            EMP_TABLE,
            EMP_TABLE[EMP_RESIGN_DATE] >= EMP_TABLE[vCalDate20]
                && EMP_TABLE[EMP_RESIGN_DATE] <= EMP_TABLE[vCalDate10]
                && EMP_TABLE[EMP_STATUS] = "Working"
        )
    )
    LessThan10Days =
    CALCULATE (
    DISTINCTCOUNT ( EMP_TABLE[EMP_NO] ),
    FILTER (
    EMP_TABLE,
    EMP_TABLE[EMP_RESIGN_DATE] >= EMP_TABLE[vCalDate10]
    && 'EMP_TABLE'[EMP_RESIGN_DATE] <= EMP_TABLE[vToday]
    && EMP_TABLE[EMP_STATUS] = "Working"
    )
    )

    Best Regards

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi saivina2920 ,

    As checked your sample pbix file, there are some syntax error in measure [10to20Days] and [LessThan10Days]. Please update them with the below formulas and check whether it can get the correct result:

    Note: The part in red font is newly added.

    10to20Days =
    CALCULATE (
        DISTINCTCOUNT ( EMP_TABLE[EMP_NO] ),
        FILTER (
            EMP_TABLE,
            EMP_TABLE[EMP_RESIGN_DATE] >= EMP_TABLE[vCalDate20]
                && EMP_TABLE[EMP_RESIGN_DATE] <= EMP_TABLE[vCalDate10]
                && EMP_TABLE[EMP_STATUS] = "Working"
        )
    )
    LessThan10Days =
    CALCULATE (
    DISTINCTCOUNT ( EMP_TABLE[EMP_NO] ),
    FILTER (
    EMP_TABLE,
    EMP_TABLE[EMP_RESIGN_DATE] >= EMP_TABLE[vCalDate10]
    && 'EMP_TABLE'[EMP_RESIGN_DATE] <= EMP_TABLE[vToday]
    && EMP_TABLE[EMP_STATUS] = "Working"
    )
    )

    Best Regards