Forum Discussion

denxx34's avatar
denxx34
Frequent Visitor
2 years ago
Solved

Total DISTINCTCOUNT() also for BLANKS() with SAMEPERIODLASTYEAR() calculations

Hello, I need help with the following DAX scenario.   Data context: We buy items from vendors. Question: Comparison of previous year with total number of suppliers. Problem: Number of suppliers ...
  • Moetazzahran's avatar
    2 years ago

    Hello, 
    If I understand your problem correctly, 

    You can use two solutions. 
    1st solution is to remove the interaction between (The Date slicer and  Fact)and the Vendor KPI card

    2nd solution is to use an All() and Calculate in your vendor measure. 

    Please let me know if it works. 

    Thank you in advance. 






  • xifeng_L's avatar
    xifeng_L
    2 years ago

    Moetazzahran You're counting all vendors this way, whereas the questioner should be needing the number of vendors based on the number of years less than or equal to the year selected by the slicer.

     

     

    denxx34  You can try below measure.

     

    #vendor = CALCULATE(DISTINCT('Fact'[Vendor]),'Calendar'[Date]<=MAX('Calendar'[Date]))

     

     

    Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

     

    Thank you~