Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have 3 columns name COL A, COL B, and COL C, All 3 are numeric column
sample data
Col A | Col B | Col C |
1 | 12 | 2 |
1 | 34 | 3 |
2 | 1 | 7 |
2 | 12 | 9 |
3 | 4 | 8 |
3 | 67 | 10 |
4 | 1 | 2 |
5 | 2 | 3 |
5 | 2 | 4 |
6 | 2 | 1 |
6 | 23 | 11 |
7 | 65 | 15 |
7 | 32 | 7 |
I am using Col A as a slicer on my page
and have a card on my page with sum(COL B) I want to filter this card value such:
I want to take the sum of all the rows of COL B with values of COl C greater than or equal to the max of selected COl A in the slicer.
for instance, if I choose 3 on my slicer, the card should give me 242 (sum of COl B ) as I filter the rows of COl C which is greater than equal to 3.
Now, if I choose 5 on my slicer card should give me 204 (sum of COl B ) as I filter the rows of COl C which is greater than equal to 5.
currently I am using the following dax for this:
calculate(sum([COL b]), filter(allselected([COL C]),[COL C]>=calculate(max([COL A]),allselected([COL A])
Solved! Go to Solution.
pls see the attachment below
Proud to be a Super User!
Hi @AMAN560 ,
See the below ,new 1 is the measure you used ,and new 2 is mine:
new1 =
CALCULATE (
SUM ( [Col B ] ),
FILTER (
ALLSELECTED ( 'Table' ),
[Col C]
>= CALCULATE ( MAX ( 'Table'[Col A ] ), ALLSELECTED ( 'Table'[Col A ] ) )
)
)
new2 =
VAR TEST =
SELECTEDVALUE ( 'Table'[Col A ] )
VAR TEST1 =
CALCULATE (
SUM ( 'Table'[Col B ] ),
FILTER ( ALL ( 'Table' ), 'Table'[Col C] >= TEST )
)
RETURN
TEST1
Return result:
And adjust your measure to the below,it will work:
new3 =
VAR test =
CALCULATE ( MAX ( 'Table'[Col A ] ), ALLSELECTED ( 'Table'[Col A ] ) )
VAR test2 =
CALCULATE (
SUM ( 'Table'[Col B ] ),
FILTER ( ALL ( 'Table' ), [Col C] >= test )
)
RETURN
test2
Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Best Regards
Lucien
Hi @AMAN560 ,
See the below ,new 1 is the measure you used ,and new 2 is mine:
new1 =
CALCULATE (
SUM ( [Col B ] ),
FILTER (
ALLSELECTED ( 'Table' ),
[Col C]
>= CALCULATE ( MAX ( 'Table'[Col A ] ), ALLSELECTED ( 'Table'[Col A ] ) )
)
)
new2 =
VAR TEST =
SELECTEDVALUE ( 'Table'[Col A ] )
VAR TEST1 =
CALCULATE (
SUM ( 'Table'[Col B ] ),
FILTER ( ALL ( 'Table' ), 'Table'[Col C] >= TEST )
)
RETURN
TEST1
Return result:
And adjust your measure to the below,it will work:
new3 =
VAR test =
CALCULATE ( MAX ( 'Table'[Col A ] ), ALLSELECTED ( 'Table'[Col A ] ) )
VAR test2 =
CALCULATE (
SUM ( 'Table'[Col B ] ),
FILTER ( ALL ( 'Table' ), [Col C] >= test )
)
RETURN
test2
Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Best Regards
Lucien
pls try this
Measure = CALCULATE( sum('Table'[Col B ]),FILTER(all('Table'),'Table'[Col C]>=SELECTEDVALUE('Table'[Col A ])))
Proud to be a Super User!
no it is not working on the sampledata itself
pls see the attachment below
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |