Forum Discussion
Dax Measure return countrows with case statement (divide, substract)
Hey Anonymous ,
Thanks a lot for your answer and help!
But this is not the full logic of what I want to show. I have attached the file (link https://drive.google.com/drive/folders/1ntXXfaaK09z8GCHOOoyORNkfTcRwoEBa?usp=sharing ). I changed the data set a bit and you can see 2 columns in the table. 2023 and 2021.
These columns explain what I want to get.
These columns must be generated for each year from Order Year. I have about 30 years in my data and therefore it will be tedious to calculate each column in Power Query. At the same time, the dynamic calculation in Power Bi is impossible. The slicer should depend on the number of years in the Date Order
Thefore it is not enough for me to sum up total values (like calculate) based on the Interval to display a unique number of rows. Perhaps I need an iterative measure that can display the unique number of the string, and not the sum of the interval.
For example, for 2023, I should get not 6 rows with 1, but 15 rows and 11 of them with 1 (in Flag column).
For example, ID 187 has 2 values in table and two of them = 1,
So, I need to return 1 rows with Inetrval = 2 (sum of rows) and Flag =1
But for ID 18789006 and Order Date 04/07/2021 instaed of 3 rows I need to display 2:
Hopefully, my explanation is clear
Thanks