Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Emerald70
Frequent Visitor

calculated accumulated values by quarter

DocumentDateQuarter
Doc11/22/2023Q1-2023
Doc12/11/2023Q1-2023
Doc23/12/2023Q1-2023
Doc34/13/2023Q2-2023
Doc45/14/2023Q2-2023
Doc46/15/2023Q2-2023
Doc410/16/2023Q3-2023
Doc411/17/2023Q3-2023
Doc412/18/2023Q3-2023
Doc10010/16/2022Q3-2022
Doc10011/17/2022Q3-2022
Doc10012/18/2022Q3-2022
Doc454512/18/2022Q3-2022

I have a quarter slicer  selection and I dont have a date  and to calculate the 
KPI : no of unique docs from the year 2022 to selected quarter
Example:   if I select the Q2-2023 on the slicer,    then the no of unique documents to be calculated from 2022 to 2023
output is :   6
Please help me to write a dax ?

 

1 ACCEPTED SOLUTION

I think you might have done some mistake. Did you adjusted the measure to get the correct value of the slicer?

 

Here is the pbix.

If you still can't solve the issue, attach your pbix, I'll take a look

View solution in original post

5 REPLIES 5
Emerald70
Frequent Visitor

it is date type only but still does not show the right result, because whatever the quarter I select it gives the same output as 6,  if I select Q3-2022 then it should give 2 but it gives 6 ,could you share your PBI file 

I think you might have done some mistake. Did you adjusted the measure to get the correct value of the slicer?

 

Here is the pbix.

If you still can't solve the issue, attach your pbix, I'll take a look

Gabry
Super User
Super User

Hello @Emerald70 ,

 

Measure = 
Var _slicer = selectedvalue('Table'[Quarter])
var _maxdate= Calculate (max('Table'[Date]), 'Table'[Quarter] = _slicer, all('Table'))
return

calculate(DISTINCTCOUNT('Table'[Document]), 'Table'[Date]<=_maxdate, all('Table'))

 

 

Let me know if this help

The solution provided is not working

Why? I tested it and it works

Gabry_1-1728894720803.pngGabry_2-1728894732507.png



You have to check if data column is date data type.
Also you asked to distinct count the documents, so to me it works as you asked. Let me know

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.